Commit 93e6c4d3 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 23670b60 6154daf1
fb9de5f27b55e28a5d4737e0aa639a50ccc3dd75
a8520a1568f0c0515eef6931c01b3fa8e55e7985
......@@ -59,8 +59,6 @@ module API
optional :message, type: String, desc: 'Specifying a message creates an annotated tag'
end
post ':id/repository/tags', :release_orchestration do
deprecate_release_notes unless params[:release_description].blank?
authorize_admin_tag
result = ::Tags::CreateService.new(user_project, current_user)
......
......@@ -50,7 +50,7 @@ module Gitlab
project.ensure_repository
refmap = Gitlab::GithubImport.refmap
project.repository.fetch_as_mirror(project.import_url, refmap: refmap, forced: true, remote_name: 'github')
project.repository.fetch_as_mirror(project.import_url, refmap: refmap, forced: true)
project.change_head(default_branch) if default_branch
......
......@@ -37,6 +37,7 @@ module Gitlab
@logger.formatter = ::Gitlab::SidekiqLogging::JSONFormatter.new
@rails_path = Dir.pwd
@dryrun = false
@list_queues = false
end
def run(argv = ARGV)
......@@ -47,6 +48,11 @@ module Gitlab
option_parser.parse!(argv)
if @dryrun && @list_queues
raise CommandError,
'The --dryrun and --list-queues options are mutually exclusive'
end
worker_metadatas = SidekiqConfig::CliMethods.worker_metadatas(@rails_path)
worker_queues = SidekiqConfig::CliMethods.worker_queues(@rails_path)
......@@ -73,6 +79,12 @@ module Gitlab
'No queues found, you must select at least one queue'
end
if @list_queues
puts queue_groups.map(&:sort) # rubocop:disable Rails/Output
return
end
unless @dryrun
@logger.info("Starting cluster with #{queue_groups.length} processes")
end
......@@ -202,6 +214,10 @@ module Gitlab
opt.on('-d', '--dryrun', 'Print commands that would be run without this flag, and quit') do |int|
@dryrun = true
end
opt.on('--list-queues', 'List matching queues, and quit') do |int|
@list_queues = true
end
end
end
end
......
......@@ -202,7 +202,7 @@ RSpec.describe Gitlab::GithubImport::Importer::RepositoryImporter do
expect(repository)
.to receive(:fetch_as_mirror)
.with(project.import_url, refmap: Gitlab::GithubImport.refmap, forced: true, remote_name: 'github')
.with(project.import_url, refmap: Gitlab::GithubImport.refmap, forced: true)
service = double
expect(Repositories::HousekeepingService)
......
......@@ -81,7 +81,7 @@ RSpec.describe Gitlab::SidekiqCluster::CLI do
end
end
context '-timeout flag' do
context 'with --timeout flag' do
it 'when given', 'starts Sidekiq workers with given timeout' do
expect(Gitlab::SidekiqCluster).to receive(:start)
.with([['foo']], default_options.merge(timeout: 10))
......@@ -97,6 +97,27 @@ RSpec.describe Gitlab::SidekiqCluster::CLI do
end
end
context 'with --list-queues flag' do
it 'errors when given --list-queues and --dryrun' do
expect { cli.run(%w(foo --list-queues --dryrun)) }.to raise_error(described_class::CommandError)
end
it 'prints out a list of queues in alphabetical order' do
expected_queues = [
'epics:epics_update_epics_dates',
'epics_new_epic_issue',
'new_epic',
'todos_destroyer:todos_destroyer_confidential_epic'
]
allow(Gitlab::SidekiqConfig::CliMethods).to receive(:query_queues).and_return(expected_queues.shuffle)
expect(cli).to receive(:puts).with([expected_queues])
cli.run(%w(--queue-selector feature_category=epics --list-queues))
end
end
context 'queue namespace expansion' do
it 'starts Sidekiq workers for all queues in all_queues.yml with a namespace in argv' do
expect(Gitlab::SidekiqConfig::CliMethods).to receive(:worker_queues).and_return(['cronjob:foo', 'cronjob:bar'])
......
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