summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-12-22 09:49:47 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-12-22 09:49:47 +0000
commite6e338f00ebdec54166542a68598bd2ab14539db (patch)
tree60e9f95a230e560d8fcd02deddbf17948a24225b
parent25bf3eb8041be93d9003d2cac1323f4d18d317ec (diff)
parent51ef4a2fed382833833f15afae1da3f98bfa5031 (diff)
downloadgitlab-ce-e6e338f00ebdec54166542a68598bd2ab14539db.tar.gz
Merge branch 'feature/sidekiq-cron-config' into 'master'
Sidekiq-cron configuration moved to gitlab.yml When `sidekiq-cron` was introduced, jobs configuration where placed in `schedule.yml` file. As discussed in #3928, this is not desirable. We moved it to `gitlab.yml`, exposing only the "cron" part of the configuration. See merge request !2087
-rw-r--r--config/gitlab.yml.example9
-rw-r--r--config/initializers/1_settings.rb9
-rw-r--r--config/initializers/sidekiq.rb7
-rw-r--r--config/schedule.yml10
4 files changed, 20 insertions, 15 deletions
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
index fcf034d7911..db68b5512b8 100644
--- a/config/gitlab.yml.example
+++ b/config/gitlab.yml.example
@@ -144,6 +144,15 @@ production: &base
# plain_url: "http://..." # default: http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon
# ssl_url: "https://..." # default: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon
+ ## Auxiliary jobs
+ # Periodically executed jobs, to self-heal Gitlab, do external synchronizations, etc.
+ # Please read here for more information: https://github.com/ondrejbartas/sidekiq-cron#adding-cron-job
+ cron_jobs:
+ # Flag stuck CI builds as failed
+ stuck_ci_builds_worker:
+ cron: "0 0 * * *"
+
+
#
# 2. GitLab CI settings
# ==========================
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index 1043fc01ab1..b581a9e4bd6 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -229,6 +229,15 @@ Settings.gravatar['ssl_url'] ||= 'https://secure.gravatar.com/avatar/%{hash}?
Settings.gravatar['host'] = Settings.get_host_without_www(Settings.gravatar['plain_url'])
#
+# Cron Jobs
+#
+Settings['cron_jobs'] ||= Settingslogic.new({})
+Settings.cron_jobs['stuck_ci_builds_worker'] ||= Settingslogic.new({})
+Settings.cron_jobs['stuck_ci_builds_worker']['cron'] ||= '0 0 * * *'
+Settings.cron_jobs['stuck_ci_builds_worker']['class'] = 'StuckCiBuildsWorker'
+
+
+#
# GitLab Shell
#
Settings['gitlab_shell'] ||= Settingslogic.new({})
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
index 2e3a71912ef..b42b718a7db 100644
--- a/config/initializers/sidekiq.rb
+++ b/config/initializers/sidekiq.rb
@@ -18,11 +18,8 @@ Sidekiq.configure_server do |config|
chain.add Gitlab::SidekiqMiddleware::MemoryKiller if ENV['SIDEKIQ_MEMORY_KILLER_MAX_RSS']
end
- # Sidekiq-cron: load recurring jobs from schedule.yml
- schedule_file = 'config/schedule.yml'
- if File.exists?(schedule_file)
- Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file)
- end
+ # Sidekiq-cron: load recurring jobs from gitlab.yml
+ Sidekiq::Cron::Job.load_from_hash! Gitlab.config.cron_jobs
# Database pool should be at least `sidekiq_concurrency` + 2
# For more info, see: https://github.com/mperham/sidekiq/blob/master/4.0-Upgrade.md
diff --git a/config/schedule.yml b/config/schedule.yml
deleted file mode 100644
index 993a95fef56..00000000000
--- a/config/schedule.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-# Here is a list of jobs that are scheduled to run periodically.
-# We use a UNIX cron notation to specify execution schedule.
-#
-# Please read here for more information:
-# https://github.com/ondrejbartas/sidekiq-cron#adding-cron-job
-
-stuck_ci_builds_worker:
- cron: "0 0 * * *"
- class: "StuckCiBuildsWorker"
- queue: "default"