diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-22 12:08:40 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-22 12:08:40 +0000 |
commit | be3e24ea3c9f497efde85900df298ce9bc42fce8 (patch) | |
tree | fd0de9443253a1b21ca9a2741dc34ba3aef795be /lib/tasks | |
parent | 001243986195143c395a9811d8254bbf1b9ebfa1 (diff) | |
download | gitlab-ce-be3e24ea3c9f497efde85900df298ce9bc42fce8.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/gitlab/sidekiq.rake | 48 | ||||
-rw-r--r-- | lib/tasks/lint.rake | 1 |
2 files changed, 49 insertions, 0 deletions
diff --git a/lib/tasks/gitlab/sidekiq.rake b/lib/tasks/gitlab/sidekiq.rake new file mode 100644 index 00000000000..f6bb0196236 --- /dev/null +++ b/lib/tasks/gitlab/sidekiq.rake @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +return if Rails.env.production? + +namespace :gitlab do + namespace :sidekiq do + namespace :all_queues_yml do + def write_yaml(path, object) + banner = <<~BANNER + # This file is generated automatically by + # bin/rake gitlab:sidekiq:all_queues_yml:generate + # + # Do not edit it manually! + BANNER + + File.write(path, banner + YAML.dump(object)) + end + + desc 'GitLab | Generate all_queues.yml based on worker definitions' + task generate: :environment do + foss_workers, ee_workers = Gitlab::SidekiqConfig.workers_for_all_queues_yml + + write_yaml(Gitlab::SidekiqConfig::FOSS_QUEUE_CONFIG_PATH, foss_workers) + + if Gitlab.ee? + write_yaml(Gitlab::SidekiqConfig::EE_QUEUE_CONFIG_PATH, ee_workers) + end + end + + desc 'GitLab | Validate that all_queues.yml matches worker definitions' + task check: :environment do + if Gitlab::SidekiqConfig.all_queues_yml_outdated? + raise <<~MSG + Changes in worker queues found, please update the metadata by running: + + bin/rake gitlab:sidekiq:all_queues_yml:generate + + Then commit and push the changes from: + + - #{Gitlab::SidekiqConfig::FOSS_QUEUE_CONFIG_PATH} + - #{Gitlab::SidekiqConfig::EE_QUEUE_CONFIG_PATH} + + MSG + end + end + end + end +end diff --git a/lib/tasks/lint.rake b/lib/tasks/lint.rake index 9a5693e78a2..42a9c027b6a 100644 --- a/lib/tasks/lint.rake +++ b/lib/tasks/lint.rake @@ -34,6 +34,7 @@ unless Rails.env.production? scss_lint gettext:lint lint:static_verification + gitlab:sidekiq:all_queues_yml:check ] if Gitlab.ee? |