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
rescue StandardError => e
repository_storage_move.do_fail!
Gitlab::ErrorTracking.track_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 }
)
Gitlab::ErrorTracking.track_and_raise_exception(e, container_klass: container.class.to_s, container_path: container.full_path)
end
private
......
......@@ -24,13 +24,13 @@ restart()
fi
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.
start_silent()
{
start_sidekiq >> $sidekiq_logfile 2>&1
start_sidekiq "$@" >> $sidekiq_logfile 2>&1
}
start_sidekiq()
......@@ -50,17 +50,17 @@ case "$1" in
stop
;;
start)
restart
restart "$@"
;;
start_silent)
warn "Deprecated: Will be removed at 13.0 (see https://gitlab.com/gitlab-org/gitlab/-/issues/196731)."
start_silent
;;
start_foreground)
start_sidekiq
start_sidekiq "$@"
;;
restart)
restart
restart "$@"
;;
*)
echo "Usage: RAILS_ENV=<env> $0 {stop|start|start_silent|start_foreground|restart}"
......
......@@ -11,7 +11,7 @@ warn()
echo "$@" 1>&2
}
get_sidekiq_pid()
get_sidekiq_pid()
{
if [ ! -f $sidekiq_pidfile ]; then
warn "No pidfile found at $sidekiq_pidfile; is Sidekiq running?"
......@@ -37,7 +37,7 @@ restart()
fi
warn "Sidekiq output will be written to $sidekiq_logfile"
start_sidekiq >> $sidekiq_logfile 2>&1
start_sidekiq "$@" >> $sidekiq_logfile 2>&1
}
start_sidekiq()
......@@ -55,7 +55,7 @@ start_sidekiq()
processes_args+=("*")
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
......@@ -63,13 +63,13 @@ case "$1" in
stop
;;
start)
restart &
restart "$@" &
;;
start_foreground)
start_sidekiq
start_sidekiq "$@"
;;
restart)
restart &
restart "$@" &
;;
*)
echo "Usage: RAILS_ENV=<env> SIDEKIQ_WORKERS=<n> $0 {stop|start|start_foreground|restart}"
......
This diff is collapsed.
......@@ -10,17 +10,22 @@ type: reference, howto
> - [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.
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
source code quality using GitLab Code Quality.
To ensure your project's code stays simple, readable, and easy to contribute to,
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:
- 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
subscription.
- Runs in [pipelines](../../../ci/pipelines/index.md) using a Docker image built in the
[GitLab Code
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).
- Runs in [pipelines](../../../ci/pipelines/index.md) by using a Docker image built in the
[GitLab Code Quality](https://gitlab.com/gitlab-org/ci-cd/codequality) project.
- 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).
- 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).
......@@ -75,21 +80,6 @@ Feature.disable(:codequality_mr_diff_annotations)
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
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
.with(wiki.repository.raw)
.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(wiki.repository_storage).to eq('default')
expect(repository_storage_move).to be_failed
......@@ -94,9 +95,10 @@ RSpec.describe Groups::UpdateRepositoryStorageService do
expect(original_wiki_repository_double).to receive(:remove)
.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
end
end
......@@ -108,9 +110,10 @@ RSpec.describe Groups::UpdateRepositoryStorageService do
expect(wiki_repository_double).to receive(: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(wiki.repository_storage).to eq('default')
end
......
......@@ -35016,9 +35016,6 @@ msgstr ""
msgid "UpdateProject|Project could not be updated!"
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}"
msgstr ""
......
......@@ -71,7 +71,9 @@ module QA
ActiveSupport::Deprecation.warn("CHROME_HEADLESS is deprecated. Use WEBDRIVER_HEADLESS instead.")
end
enabled?(ENV['WEBDRIVER_HEADLESS']) || enabled?(ENV['CHROME_HEADLESS'])
return enabled?(ENV['WEBDRIVER_HEADLESS']) unless ENV['WEBDRIVER_HEADLESS'].nil?
enabled?(ENV['CHROME_HEADLESS'])
end
# set to 'true' to have Chrome use a fixed profile directory
......@@ -336,7 +338,7 @@ module QA
# the feature is supported in the environment under test.
# All features are supported by default.
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)
end
......@@ -398,7 +400,9 @@ module QA
def remote_grid_credentials
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}@"
end
......
......@@ -55,11 +55,6 @@ RSpec.describe QA::Runtime::Env do
end
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',
method: :webdriver_headless?,
env_key: 'WEBDRIVER_HEADLESS',
......
......@@ -83,9 +83,10 @@ RSpec.describe Projects::UpdateRepositoryStorageService do
.with(project.repository.raw)
.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.repository_storage).to eq('default')
expect(repository_storage_move).to be_failed
......@@ -101,9 +102,10 @@ RSpec.describe Projects::UpdateRepositoryStorageService do
expect(original_project_repository_double).to receive(:remove)
.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
end
end
......@@ -118,9 +120,10 @@ RSpec.describe Projects::UpdateRepositoryStorageService do
expect(project_repository_double).to receive(: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.repository_storage).to eq('default')
end
......
......@@ -75,9 +75,10 @@ RSpec.describe Snippets::UpdateRepositoryStorageService do
.with(snippet.repository.raw)
.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.repository_storage).to eq('default')
expect(repository_storage_move).to be_failed
......@@ -93,9 +94,10 @@ RSpec.describe Snippets::UpdateRepositoryStorageService do
expect(original_snippet_repository_double).to receive(:remove)
.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
end
end
......@@ -107,9 +109,10 @@ RSpec.describe Snippets::UpdateRepositoryStorageService do
expect(snippet_repository_double).to receive(: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.repository_storage).to eq('default')
end
......
......@@ -123,9 +123,10 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type|
.with(repository.raw)
.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.repository_storage).to eq('default')
expect(repository_storage_move).to be_failed
......@@ -149,9 +150,10 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type|
expect(original_repository_double).to receive(:remove)
.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
end
end
......@@ -170,9 +172,10 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type|
allow(repository_double).to receive(: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.repository_storage).to eq('default')
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