Thanks @jacobvosmaer I was about to create a similar issue. @brodock claims that GitLab config object is available in schedule.yml (I'm not sure how). If that's the case, we should be able to do this?
@brodock brought up in chat whether we should change the configuration key to something where the user defines a full cron syntax value, or whether we re-use the existing configuration for hour and minute and add additional for the other fields.
@dblessing we can have access to it because it is loaded by config/initializers/sidekiq.rb after initial Rails bootstrap.
If we move that logic to the Gitlab config file, we will have to make a few changes into the sidekiq (cron) initializer to decide whether or not run LdapSyncWorker (which I think its okay).
I vote for cron syntax, as its lot more powerful IMHO, ex:
# every 6 hours, interleaving full hours with halves, on workdays only*/30 */6 * 1-5 *
It makes sense to move it to gitlab.yml, I haven't done that because of the scary warning
Will make a proposal draft here so we can discuss, ok?
production:&base## 1. GitLab app settings# ==========================# ...## Gravatar## For Libravatar see: http://doc.gitlab.com/ce/customization/libravatar.htmlgitlab:# ...## 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-jobcron_jobs:stuck_ci_builds_worker:cron:"00***"class:"StuckCiBuildsWorker"queue:"default"## GitLab EE only jobs:#historical_data_worker:cron:"012***"class:"HistoricalDataWorker"queue:"default"update_all_mirrors_worker:cron:"0****"class:"UpdateAllMirrorsWorker"queue:"default"# In addition to refreshing users when they log in,# enabling this setting will refresh LDAP user membership once a day.ldap_sync_worker:cron:"301***"class:"LdapSyncWorker"queue:"default"
Even if we choose to implement a config key per field it can still handle all the same values. I'm not sure about the best way to go here. Breaking changes are not ideal.
@dblessing are you talking about the existing config options for the LDAP Sync worker? I think in this case it is OK to deprecate that setting in favor of the new cron format.
@brodock that looks much nicer. I would only change it so that config/initializers/1_settings.rb fills in the queue and class fields. The class field should not even be configurable in gitlab.yml.
cron_jobs: stuck_ci_builds_worker: cron: "0 0 * * *" # # GitLab EE only jobs: # historical_data_worker: cron: "0 12 * * *" update_all_mirrors_worker: cron: "0 * * * *" # In addition to refreshing users when they log in, # enabling this setting will refresh LDAP user membership once a day. ldap_sync_worker: cron: "30 1 * * *"