Commit 020ed6b4 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents d7527acf b4e5af57
...@@ -38,11 +38,7 @@ module UpdateRepositoryStorageMethods ...@@ -38,11 +38,7 @@ module UpdateRepositoryStorageMethods
rescue StandardError => e rescue StandardError => e
repository_storage_move.do_fail! repository_storage_move.do_fail!
Gitlab::ErrorTracking.track_exception(e, container_klass: container.class.to_s, container_path: container.full_path) Gitlab::ErrorTracking.track_and_raise_exception(e, container_klass: container.class.to_s, container_path: container.full_path)
ServiceResponse.error(
message: s_("UpdateRepositoryStorage|Error moving repository storage for %{container_full_path} - %{message}") % { container_full_path: container.full_path, message: e.message }
)
end end
private private
......
...@@ -24,13 +24,13 @@ restart() ...@@ -24,13 +24,13 @@ restart()
fi fi
pkill -u $gitlab_user -f 'sidekiq [0-9]' pkill -u $gitlab_user -f 'sidekiq [0-9]'
start_sidekiq -P $sidekiq_pidfile -d -L $sidekiq_logfile >> $sidekiq_logfile 2>&1 start_sidekiq -P $sidekiq_pidfile -d -L $sidekiq_logfile "$@" >> $sidekiq_logfile 2>&1
} }
# Starts on foreground but output to the logfile instead stdout. # Starts on foreground but output to the logfile instead stdout.
start_silent() start_silent()
{ {
start_sidekiq >> $sidekiq_logfile 2>&1 start_sidekiq "$@" >> $sidekiq_logfile 2>&1
} }
start_sidekiq() start_sidekiq()
...@@ -50,17 +50,17 @@ case "$1" in ...@@ -50,17 +50,17 @@ case "$1" in
stop stop
;; ;;
start) start)
restart restart "$@"
;; ;;
start_silent) start_silent)
warn "Deprecated: Will be removed at 13.0 (see https://gitlab.com/gitlab-org/gitlab/-/issues/196731)." warn "Deprecated: Will be removed at 13.0 (see https://gitlab.com/gitlab-org/gitlab/-/issues/196731)."
start_silent start_silent
;; ;;
start_foreground) start_foreground)
start_sidekiq start_sidekiq "$@"
;; ;;
restart) restart)
restart restart "$@"
;; ;;
*) *)
echo "Usage: RAILS_ENV=<env> $0 {stop|start|start_silent|start_foreground|restart}" echo "Usage: RAILS_ENV=<env> $0 {stop|start|start_silent|start_foreground|restart}"
......
...@@ -11,7 +11,7 @@ warn() ...@@ -11,7 +11,7 @@ warn()
echo "$@" 1>&2 echo "$@" 1>&2
} }
get_sidekiq_pid() get_sidekiq_pid()
{ {
if [ ! -f $sidekiq_pidfile ]; then if [ ! -f $sidekiq_pidfile ]; then
warn "No pidfile found at $sidekiq_pidfile; is Sidekiq running?" warn "No pidfile found at $sidekiq_pidfile; is Sidekiq running?"
...@@ -37,7 +37,7 @@ restart() ...@@ -37,7 +37,7 @@ restart()
fi fi
warn "Sidekiq output will be written to $sidekiq_logfile" warn "Sidekiq output will be written to $sidekiq_logfile"
start_sidekiq >> $sidekiq_logfile 2>&1 start_sidekiq "$@" >> $sidekiq_logfile 2>&1
} }
start_sidekiq() start_sidekiq()
...@@ -55,7 +55,7 @@ start_sidekiq() ...@@ -55,7 +55,7 @@ start_sidekiq()
processes_args+=("*") processes_args+=("*")
done done
${cmd} bin/sidekiq-cluster "${processes_args[@]}" -P $sidekiq_pidfile -e $RAILS_ENV ${cmd} bin/sidekiq-cluster "${processes_args[@]}" -P $sidekiq_pidfile -e $RAILS_ENV "$@"
} }
case "$1" in case "$1" in
...@@ -63,13 +63,13 @@ case "$1" in ...@@ -63,13 +63,13 @@ case "$1" in
stop stop
;; ;;
start) start)
restart & restart "$@" &
;; ;;
start_foreground) start_foreground)
start_sidekiq start_sidekiq "$@"
;; ;;
restart) restart)
restart & restart "$@" &
;; ;;
*) *)
echo "Usage: RAILS_ENV=<env> SIDEKIQ_WORKERS=<n> $0 {stop|start|start_foreground|restart}" echo "Usage: RAILS_ENV=<env> SIDEKIQ_WORKERS=<n> $0 {stop|start|start_foreground|restart}"
......
...@@ -6,72 +6,91 @@ disqus_identifier: 'https://docs.gitlab.com/ee/user/project/pipelines/settings.h ...@@ -6,72 +6,91 @@ disqus_identifier: 'https://docs.gitlab.com/ee/user/project/pipelines/settings.h
type: reference, howto type: reference, howto
--- ---
# Pipeline settings **(FREE)** # Customize pipeline configuration **(FREE)**
To reach the pipelines settings navigate to your project's You can customize how pipelines run for your project.
**Settings > CI/CD**.
The following settings can be configured per project.
<i class="fa fa-youtube-play youtube" aria-hidden="true"></i> <i class="fa fa-youtube-play youtube" aria-hidden="true"></i>
For an overview, watch the video [GitLab CI Pipeline, Artifacts, and Environments](https://www.youtube.com/watch?v=PCKDICEe10s). For an overview of pipelines, watch the video [GitLab CI Pipeline, Artifacts, and Environments](https://www.youtube.com/watch?v=PCKDICEe10s).
Watch also [GitLab CI pipeline tutorial for beginners](https://www.youtube.com/watch?v=Jav4vbUrqII). Watch also [GitLab CI pipeline tutorial for beginners](https://www.youtube.com/watch?v=Jav4vbUrqII).
You can use the pipeline status to determine if a merge request can be merged: ## Visibility of pipelines
- [Merge when pipeline succeeds](../../user/project/merge_requests/merge_when_pipeline_succeeds.md). Pipeline visibility is determined by:
- [Only allow merge requests to be merged if the pipeline succeeds](../../user/project/merge_requests/merge_when_pipeline_succeeds.md#only-allow-merge-requests-to-be-merged-if-the-pipeline-succeeds).
## Git strategy - Your current [user access level](../../user/permissions.md).
- The **Public pipelines** project setting under your project's **Settings > CI/CD > General pipelines**.
With Git strategy, you can choose the default way your repository is fetched NOTE:
from GitLab in a job. If the project visibility is set to **Private**, the [**Public pipelines** setting has no effect](../enable_or_disable_ci.md#per-project-user-setting).
There are two options. Using: This also determines the visibility of these related features:
- `git clone`, which is slower because it clones the repository from scratch - Job output logs
for every job, ensuring that the local working copy is always pristine. - Job artifacts
- `git fetch`, which is default in GitLab and faster as it re-uses the local working copy (falling - The [pipeline security dashboard](../../user/application_security/security_dashboard/index.md#pipeline-security) **(ULTIMATE)**
back to clone if it doesn't exist).
This is recommended, especially for [large repositories](../large_repositories/index.md#git-strategy).
The configured Git strategy can be overridden by the [`GIT_STRATEGY` variable](../runners/configure_runners.md#git-strategy) Job logs and artifacts are [not visible for guest users and non-project members](https://gitlab.com/gitlab-org/gitlab/-/issues/25649).
in `.gitlab-ci.yml`.
## Git shallow clone If **Public pipelines** is enabled (default):
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/28919) in GitLab 12.0. - For **public** projects, anyone can view the pipelines and related features.
- For **internal** projects, any logged in user except [external users](../../user/permissions.md#external-users) can view the pipelines
and related features.
- For **private** projects, any project member (Guest or higher) can view the pipelines
and related features.
It is possible to limit the number of changes that GitLab CI/CD fetches when cloning If **Public pipelines** is disabled:
a repository. Setting a limit to `git depth` can speed up Pipelines execution.
In GitLab 12.0 and later, newly created projects automatically have a default - For **public** projects, anyone can view the pipelines, but only members
`git depth` value of `50`. The maximum allowed value is `1000`. (Reporter or higher) can access the related features.
- For **internal** projects, any logged in user except [external users](../../user/permissions.md#external-users) can view the pipelines.
However, only members (reporter or higher) can access the job related features.
- For **private** projects, only project members (reporter or higher)
can view the pipelines or access the related features.
To disable shallow clone and make GitLab CI/CD fetch all branches and tags each time, ## Auto-cancel redundant pipelines
keep the value empty or set to `0`.
This value can also be [overridden by `GIT_DEPTH`](../large_repositories/index.md#shallow-cloning) variable in `.gitlab-ci.yml` file. You can set pending or running pipelines to cancel automatically when a new pipeline runs on the same branch. You can enable this in the project settings:
## Timeout 1. Go to **Settings > CI/CD**.
1. Expand **General Pipelines**.
1. Check the **Auto-cancel redundant pipelines** checkbox.
1. Click **Save changes**.
Timeout defines the maximum amount of time in minutes that a job is able run. Use the [`interruptible`](../yaml/index.md#interruptible) keyword to indicate if a
This is configurable under your project's **Settings > CI/CD > General pipelines settings**. running job can be cancelled before it completes.
The default value is 60 minutes. Decrease the time limit if you want to impose
a hard limit on your jobs' running time or increase it otherwise. In any case,
if the job surpasses the threshold, it is marked as failed.
### Timeout overriding for runners ## Skip outdated deployment jobs
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17221) in GitLab 10.7. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/25276) in GitLab 12.9.
Project defined timeout (either specific timeout set by user or the default Your project may have multiple concurrent deployment jobs that are
60 minutes timeout) may be [overridden for runners](../runners/configure_runners.md#set-maximum-job-timeout-for-a-runner). scheduled to run in the same time frame.
## Maximum artifacts size **(FREE SELF)** This can lead to a situation where an older deployment job runs after a
newer one, which may not be what you want.
For information about setting a maximum artifact size for a project, see To avoid this scenario:
[Maximum artifacts size](../../user/admin_area/settings/continuous_integration.md#maximum-artifacts-size).
1. Go to **Settings > CI/CD**.
1. Expand **General pipelines**.
1. Check the **Skip outdated deployment jobs** checkbox.
1. Click **Save changes**.
When enabled, any older deployments job are skipped when a new deployment starts.
For more information, see [Deployment safety](../environments/deployment_safety.md).
## Retry outdated jobs
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/211339) in GitLab 13.6.
A deployment job can fail because a newer one has run. If you retry the failed deployment job, the
environment could be overwritten with older source code. If you click **Retry**, a modal warns you
about this and asks for confirmation.
For more information, see [Deployment safety](../environments/deployment_safety.md).
## Custom CI/CD configuration file ## Custom CI/CD configuration file
...@@ -115,6 +134,52 @@ configuration file. For example: ...@@ -115,6 +134,52 @@ configuration file. For example:
Other users and projects can access the configuration file without being Other users and projects can access the configuration file without being
able to edit it. able to edit it.
## Git strategy
With Git strategy, you can choose the default way your repository is fetched
from GitLab in a job.
There are two options. Using:
- `git clone`, which is slower because it clones the repository from scratch
for every job, ensuring that the local working copy is always pristine.
- `git fetch`, which is default in GitLab and faster as it re-uses the local working copy (falling
back to clone if it doesn't exist).
This is recommended, especially for [large repositories](../large_repositories/index.md#git-strategy).
The configured Git strategy can be overridden by the [`GIT_STRATEGY` variable](../runners/configure_runners.md#git-strategy)
in `.gitlab-ci.yml`.
## Git shallow clone
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/28919) in GitLab 12.0.
It is possible to limit the number of changes that GitLab CI/CD fetches when cloning
a repository. Setting a limit to `git depth` can speed up Pipelines execution.
In GitLab 12.0 and later, newly created projects automatically have a default
`git depth` value of `50`. The maximum allowed value is `1000`.
To disable shallow clone and make GitLab CI/CD fetch all branches and tags each time,
keep the value empty or set to `0`.
This value can also be [overridden by `GIT_DEPTH`](../large_repositories/index.md#shallow-cloning) variable in `.gitlab-ci.yml` file.
## Timeout
Timeout defines the maximum amount of time in minutes that a job is able run.
This is configurable under your project's **Settings > CI/CD > General pipelines settings**.
The default value is 60 minutes. Decrease the time limit if you want to impose
a hard limit on your jobs' running time or increase it otherwise. In any case,
if the job surpasses the threshold, it is marked as failed.
### Timeout overriding for runners
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17221) in GitLab 10.7.
Project defined timeout (either specific timeout set by user or the default
60 minutes timeout) may be [overridden for runners](../runners/configure_runners.md#set-maximum-job-timeout-for-a-runner).
## Test coverage parsing ## Test coverage parsing
If you use test coverage in your code, GitLab can capture its output in the If you use test coverage in your code, GitLab can capture its output in the
...@@ -184,84 +249,6 @@ For example: ...@@ -184,84 +249,6 @@ For example:
lein cloverage | perl -pe 's/\e\[?.*?[\@-~]//g' lein cloverage | perl -pe 's/\e\[?.*?[\@-~]//g'
``` ```
## Visibility of pipelines
Pipeline visibility is determined by:
- Your current [user access level](../../user/permissions.md).
- The **Public pipelines** project setting under your project's **Settings > CI/CD > General pipelines**.
NOTE:
If the project visibility is set to **Private**, the [**Public pipelines** setting has no effect](../enable_or_disable_ci.md#per-project-user-setting).
This also determines the visibility of these related features:
- Job output logs
- Job artifacts
- The [pipeline security dashboard](../../user/application_security/security_dashboard/index.md#pipeline-security) **(ULTIMATE)**
Job logs and artifacts are [not visible for guest users and non-project members](https://gitlab.com/gitlab-org/gitlab/-/issues/25649).
If **Public pipelines** is enabled (default):
- For **public** projects, anyone can view the pipelines and related features.
- For **internal** projects, any logged in user except [external users](../../user/permissions.md#external-users) can view the pipelines
and related features.
- For **private** projects, any project member (guest or higher) can view the pipelines
and related features.
If **Public pipelines** is disabled:
- For **public** projects, anyone can view the pipelines, but only members
(reporter or higher) can access the related features.
- For **internal** projects, any logged in user except [external users](../../user/permissions.md#external-users) can view the pipelines.
However, only members (reporter or higher) can access the job related features.
- For **private** projects, only project members (reporter or higher)
can view the pipelines or access the related features.
## Auto-cancel redundant pipelines
You can set pending or running pipelines to cancel automatically when a new pipeline runs on the same branch. You can enable this in the project settings:
1. Go to **Settings > CI/CD**.
1. Expand **General Pipelines**.
1. Check the **Auto-cancel redundant pipelines** checkbox.
1. Click **Save changes**.
Use the [`interruptible`](../yaml/index.md#interruptible) keyword to indicate if a
running job can be cancelled before it completes.
## Skip outdated deployment jobs
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/25276) in GitLab 12.9.
Your project may have multiple concurrent deployment jobs that are
scheduled to run in the same time frame.
This can lead to a situation where an older deployment job runs after a
newer one, which may not be what you want.
To avoid this scenario:
1. Go to **Settings > CI/CD**.
1. Expand **General pipelines**.
1. Check the **Skip outdated deployment jobs** checkbox.
1. Click **Save changes**.
When enabled, any older deployments job are skipped when a new deployment starts.
For more information, see [Deployment safety](../environments/deployment_safety.md).
## Retry outdated jobs
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/211339) in GitLab 13.6.
A deployment job can fail because a newer one has run. If you retry the failed deployment job, the
environment could be overwritten with older source code. If you click **Retry**, a modal warns you
about this and asks for confirmation.
For more information, see [Deployment safety](../environments/deployment_safety.md).
## Pipeline Badges ## Pipeline Badges
In the pipelines settings page you can find pipeline status and test coverage In the pipelines settings page you can find pipeline status and test coverage
...@@ -353,6 +340,10 @@ https://gitlab.com/gitlab-org/gitlab/badges/main/coverage.svg?job=karma&key_text ...@@ -353,6 +340,10 @@ https://gitlab.com/gitlab-org/gitlab/badges/main/coverage.svg?job=karma&key_text
![Badge with custom text and width](https://gitlab.com/gitlab-org/gitlab/badges/main/coverage.svg?job=karma&key_text=Frontend+Coverage&key_width=130) ![Badge with custom text and width](https://gitlab.com/gitlab-org/gitlab/badges/main/coverage.svg?job=karma&key_text=Frontend+Coverage&key_width=130)
## Related topics
- [Maximum artifacts size](../../user/admin_area/settings/continuous_integration.md#maximum-artifacts-size).
<!-- ## Troubleshooting <!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues Include any troubleshooting steps that you can foresee. If you know beforehand what issues
......
...@@ -10,17 +10,22 @@ type: reference, howto ...@@ -10,17 +10,22 @@ type: reference, howto
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/1984) in GitLab 9.3. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/1984) in GitLab 9.3.
> - Made [available in all tiers](https://gitlab.com/gitlab-org/gitlab/-/issues/212499) in 13.2. > - Made [available in all tiers](https://gitlab.com/gitlab-org/gitlab/-/issues/212499) in 13.2.
Ensuring your project's code stays simple, readable and easy to contribute to can be problematic. With the help of [GitLab CI/CD](../../../ci/index.md), you can analyze your To ensure your project's code stays simple, readable, and easy to contribute to,
source code quality using GitLab Code Quality. you can use [GitLab CI/CD](../../../ci/index.md) to analyze your source code quality.
For example, while you're implementing a feature, you can run Code Quality reports
to analyze how your improvements are impacting your code's quality. You can
use this information to ensure that your changes are improving performance rather
than degrading it.
Code Quality: Code Quality:
- Uses [Engines](https://docs.codeclimate.com/docs/list-of-engines) supported by Code Climate, which are - Uses [plugins](https://docs.codeclimate.com/docs/list-of-engines) supported by Code Climate, which are
free and open source. Code Quality does not require a Code Climate free and open source. Code Quality does not require a Code Climate
subscription. subscription.
- Runs in [pipelines](../../../ci/pipelines/index.md) using a Docker image built in the - Runs in [pipelines](../../../ci/pipelines/index.md) by using a Docker image built in the
[GitLab Code [GitLab Code Quality](https://gitlab.com/gitlab-org/ci-cd/codequality) project.
Quality](https://gitlab.com/gitlab-org/ci-cd/codequality) project using [default Code Climate configurations](https://gitlab.com/gitlab-org/ci-cd/codequality/-/tree/master/codeclimate_defaults). - Uses [default Code Climate configurations](https://gitlab.com/gitlab-org/ci-cd/codequality/-/tree/master/codeclimate_defaults).
- Can make use of a [template](#example-configuration). - Can make use of a [template](#example-configuration).
- Is available by using [Auto Code Quality](../../../topics/autodevops/stages.md#auto-code-quality), provided by [Auto DevOps](../../../topics/autodevops/index.md). - Is available by using [Auto Code Quality](../../../topics/autodevops/stages.md#auto-code-quality), provided by [Auto DevOps](../../../topics/autodevops/index.md).
- Can be extended through [Analysis Plugins](https://docs.codeclimate.com/docs/list-of-engines) or a [custom tool](#implementing-a-custom-tool). - Can be extended through [Analysis Plugins](https://docs.codeclimate.com/docs/list-of-engines) or a [custom tool](#implementing-a-custom-tool).
...@@ -75,21 +80,6 @@ Feature.disable(:codequality_mr_diff_annotations) ...@@ -75,21 +80,6 @@ Feature.disable(:codequality_mr_diff_annotations)
Feature.disable(:codequality_mr_diff_annotations, Project.find(<project id>)) Feature.disable(:codequality_mr_diff_annotations, Project.find(<project id>))
``` ```
## Use cases
For instance, consider the following workflow:
1. Your backend team member starts a new implementation for making a certain
feature in your app faster.
1. With Code Quality reports, they analyze how their implementation is impacting
the code quality.
1. The metrics show that their code degrades the quality by 10 points.
1. You ask a co-worker to help them with this modification.
1. They both work on the changes until Code Quality report displays no
degradations, only improvements.
1. You approve the merge request and authorize its deployment to staging.
1. Once verified, their changes are deployed to production.
## Example configuration ## Example configuration
This example shows how to run Code Quality on your code by using GitLab CI/CD and Docker. This example shows how to run Code Quality on your code by using GitLab CI/CD and Docker.
......
...@@ -76,9 +76,10 @@ RSpec.describe Groups::UpdateRepositoryStorageService do ...@@ -76,9 +76,10 @@ RSpec.describe Groups::UpdateRepositoryStorageService do
.with(wiki.repository.raw) .with(wiki.repository.raw)
.and_raise(Gitlab::Git::CommandError) .and_raise(Gitlab::Git::CommandError)
result = subject.execute expect do
subject.execute
end.to raise_error(Gitlab::Git::CommandError)
expect(result).to be_error
expect(group.reload).not_to be_repository_read_only expect(group.reload).not_to be_repository_read_only
expect(wiki.repository_storage).to eq('default') expect(wiki.repository_storage).to eq('default')
expect(repository_storage_move).to be_failed expect(repository_storage_move).to be_failed
...@@ -94,9 +95,10 @@ RSpec.describe Groups::UpdateRepositoryStorageService do ...@@ -94,9 +95,10 @@ RSpec.describe Groups::UpdateRepositoryStorageService do
expect(original_wiki_repository_double).to receive(:remove) expect(original_wiki_repository_double).to receive(:remove)
.and_raise(Gitlab::Git::CommandError) .and_raise(Gitlab::Git::CommandError)
result = subject.execute expect do
subject.execute
end.to raise_error(Gitlab::Git::CommandError)
expect(result).to be_error
expect(repository_storage_move).to be_cleanup_failed expect(repository_storage_move).to be_cleanup_failed
end end
end end
...@@ -108,9 +110,10 @@ RSpec.describe Groups::UpdateRepositoryStorageService do ...@@ -108,9 +110,10 @@ RSpec.describe Groups::UpdateRepositoryStorageService do
expect(wiki_repository_double).to receive(:checksum) expect(wiki_repository_double).to receive(:checksum)
.and_return('not matching checksum') .and_return('not matching checksum')
result = subject.execute expect do
subject.execute
end.to raise_error(UpdateRepositoryStorageMethods::Error, /Failed to verify wiki repository checksum from \w+ to not matching checksum/)
expect(result).to be_error
expect(group).not_to be_repository_read_only expect(group).not_to be_repository_read_only
expect(wiki.repository_storage).to eq('default') expect(wiki.repository_storage).to eq('default')
end end
......
...@@ -35016,9 +35016,6 @@ msgstr "" ...@@ -35016,9 +35016,6 @@ msgstr ""
msgid "UpdateProject|Project could not be updated!" msgid "UpdateProject|Project could not be updated!"
msgstr "" msgstr ""
msgid "UpdateRepositoryStorage|Error moving repository storage for %{container_full_path} - %{message}"
msgstr ""
msgid "UpdateRepositoryStorage|Failed to verify %{type} repository checksum from %{old} to %{new}" msgid "UpdateRepositoryStorage|Failed to verify %{type} repository checksum from %{old} to %{new}"
msgstr "" msgstr ""
......
...@@ -71,7 +71,9 @@ module QA ...@@ -71,7 +71,9 @@ module QA
ActiveSupport::Deprecation.warn("CHROME_HEADLESS is deprecated. Use WEBDRIVER_HEADLESS instead.") ActiveSupport::Deprecation.warn("CHROME_HEADLESS is deprecated. Use WEBDRIVER_HEADLESS instead.")
end end
enabled?(ENV['WEBDRIVER_HEADLESS']) || enabled?(ENV['CHROME_HEADLESS']) return enabled?(ENV['WEBDRIVER_HEADLESS']) unless ENV['WEBDRIVER_HEADLESS'].nil?
enabled?(ENV['CHROME_HEADLESS'])
end end
# set to 'true' to have Chrome use a fixed profile directory # set to 'true' to have Chrome use a fixed profile directory
...@@ -336,7 +338,7 @@ module QA ...@@ -336,7 +338,7 @@ module QA
# the feature is supported in the environment under test. # the feature is supported in the environment under test.
# All features are supported by default. # All features are supported by default.
def can_test?(feature) def can_test?(feature)
raise ArgumentError, %Q(Unknown feature "#{feature}") unless SUPPORTED_FEATURES.include? feature raise ArgumentError, %(Unknown feature "#{feature}") unless SUPPORTED_FEATURES.include? feature
enabled?(ENV[SUPPORTED_FEATURES[feature]], default: true) enabled?(ENV[SUPPORTED_FEATURES[feature]], default: true)
end end
...@@ -398,7 +400,9 @@ module QA ...@@ -398,7 +400,9 @@ module QA
def remote_grid_credentials def remote_grid_credentials
if remote_grid_username if remote_grid_username
raise ArgumentError, %Q(Please provide an access key for user "#{remote_grid_username}") unless remote_grid_access_key unless remote_grid_access_key
raise ArgumentError, %(Please provide an access key for user "#{remote_grid_username}")
end
return "#{remote_grid_username}:#{remote_grid_access_key}@" return "#{remote_grid_username}:#{remote_grid_access_key}@"
end end
......
...@@ -55,11 +55,6 @@ RSpec.describe QA::Runtime::Env do ...@@ -55,11 +55,6 @@ RSpec.describe QA::Runtime::Env do
end end
describe '.webdriver_headless?' do describe '.webdriver_headless?' do
before do
# We need to set this because we have a fallback for CHROME_HEADLESS
stub_env('CHROME_HEADLESS', 'false')
end
it_behaves_like 'boolean method', it_behaves_like 'boolean method',
method: :webdriver_headless?, method: :webdriver_headless?,
env_key: 'WEBDRIVER_HEADLESS', env_key: 'WEBDRIVER_HEADLESS',
......
...@@ -83,9 +83,10 @@ RSpec.describe Projects::UpdateRepositoryStorageService do ...@@ -83,9 +83,10 @@ RSpec.describe Projects::UpdateRepositoryStorageService do
.with(project.repository.raw) .with(project.repository.raw)
.and_raise(Gitlab::Git::CommandError) .and_raise(Gitlab::Git::CommandError)
result = subject.execute expect do
subject.execute
end.to raise_error(Gitlab::Git::CommandError)
expect(result).to be_error
expect(project).not_to be_repository_read_only expect(project).not_to be_repository_read_only
expect(project.repository_storage).to eq('default') expect(project.repository_storage).to eq('default')
expect(repository_storage_move).to be_failed expect(repository_storage_move).to be_failed
...@@ -101,9 +102,10 @@ RSpec.describe Projects::UpdateRepositoryStorageService do ...@@ -101,9 +102,10 @@ RSpec.describe Projects::UpdateRepositoryStorageService do
expect(original_project_repository_double).to receive(:remove) expect(original_project_repository_double).to receive(:remove)
.and_raise(Gitlab::Git::CommandError) .and_raise(Gitlab::Git::CommandError)
result = subject.execute expect do
subject.execute
end.to raise_error(Gitlab::Git::CommandError)
expect(result).to be_error
expect(repository_storage_move).to be_cleanup_failed expect(repository_storage_move).to be_cleanup_failed
end end
end end
...@@ -118,9 +120,10 @@ RSpec.describe Projects::UpdateRepositoryStorageService do ...@@ -118,9 +120,10 @@ RSpec.describe Projects::UpdateRepositoryStorageService do
expect(project_repository_double).to receive(:checksum) expect(project_repository_double).to receive(:checksum)
.and_return('not matching checksum') .and_return('not matching checksum')
result = subject.execute expect do
subject.execute
end.to raise_error(UpdateRepositoryStorageMethods::Error, /Failed to verify project repository checksum/)
expect(result).to be_error
expect(project).not_to be_repository_read_only expect(project).not_to be_repository_read_only
expect(project.repository_storage).to eq('default') expect(project.repository_storage).to eq('default')
end end
......
...@@ -75,9 +75,10 @@ RSpec.describe Snippets::UpdateRepositoryStorageService do ...@@ -75,9 +75,10 @@ RSpec.describe Snippets::UpdateRepositoryStorageService do
.with(snippet.repository.raw) .with(snippet.repository.raw)
.and_raise(Gitlab::Git::CommandError) .and_raise(Gitlab::Git::CommandError)
result = subject.execute expect do
subject.execute
end.to raise_error(Gitlab::Git::CommandError)
expect(result).to be_error
expect(snippet).not_to be_repository_read_only expect(snippet).not_to be_repository_read_only
expect(snippet.repository_storage).to eq('default') expect(snippet.repository_storage).to eq('default')
expect(repository_storage_move).to be_failed expect(repository_storage_move).to be_failed
...@@ -93,9 +94,10 @@ RSpec.describe Snippets::UpdateRepositoryStorageService do ...@@ -93,9 +94,10 @@ RSpec.describe Snippets::UpdateRepositoryStorageService do
expect(original_snippet_repository_double).to receive(:remove) expect(original_snippet_repository_double).to receive(:remove)
.and_raise(Gitlab::Git::CommandError) .and_raise(Gitlab::Git::CommandError)
result = subject.execute expect do
subject.execute
end.to raise_error(Gitlab::Git::CommandError)
expect(result).to be_error
expect(repository_storage_move).to be_cleanup_failed expect(repository_storage_move).to be_cleanup_failed
end end
end end
...@@ -107,9 +109,10 @@ RSpec.describe Snippets::UpdateRepositoryStorageService do ...@@ -107,9 +109,10 @@ RSpec.describe Snippets::UpdateRepositoryStorageService do
expect(snippet_repository_double).to receive(:checksum) expect(snippet_repository_double).to receive(:checksum)
.and_return('not matching checksum') .and_return('not matching checksum')
result = subject.execute expect do
subject.execute
end.to raise_error(UpdateRepositoryStorageMethods::Error, /Failed to verify snippet repository checksum from \w+ to not matching checksum/)
expect(result).to be_error
expect(snippet).not_to be_repository_read_only expect(snippet).not_to be_repository_read_only
expect(snippet.repository_storage).to eq('default') expect(snippet.repository_storage).to eq('default')
end end
......
...@@ -123,9 +123,10 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type| ...@@ -123,9 +123,10 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type|
.with(repository.raw) .with(repository.raw)
.and_raise(Gitlab::Git::CommandError) .and_raise(Gitlab::Git::CommandError)
result = subject.execute expect do
subject.execute
end.to raise_error(Gitlab::Git::CommandError)
expect(result).to be_error
expect(project).not_to be_repository_read_only expect(project).not_to be_repository_read_only
expect(project.repository_storage).to eq('default') expect(project.repository_storage).to eq('default')
expect(repository_storage_move).to be_failed expect(repository_storage_move).to be_failed
...@@ -149,9 +150,10 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type| ...@@ -149,9 +150,10 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type|
expect(original_repository_double).to receive(:remove) expect(original_repository_double).to receive(:remove)
.and_raise(Gitlab::Git::CommandError) .and_raise(Gitlab::Git::CommandError)
result = subject.execute expect do
subject.execute
end.to raise_error(Gitlab::Git::CommandError)
expect(result).to be_error
expect(repository_storage_move).to be_cleanup_failed expect(repository_storage_move).to be_cleanup_failed
end end
end end
...@@ -170,9 +172,10 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type| ...@@ -170,9 +172,10 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type|
allow(repository_double).to receive(:checksum) allow(repository_double).to receive(:checksum)
.and_return('not matching checksum') .and_return('not matching checksum')
result = subject.execute expect do
subject.execute
end.to raise_error(UpdateRepositoryStorageMethods::Error, /Failed to verify \w+ repository checksum from \w+ to not matching checksum/)
expect(result).to be_error
expect(project).not_to be_repository_read_only expect(project).not_to be_repository_read_only
expect(project.repository_storage).to eq('default') expect(project.repository_storage).to eq('default')
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment