Skip to content

Commit 616b420

Browse files
authored
Merge pull request #3236 from th-2021/cronjob-vars
Cronjob vars
2 parents 1bf018a + 7f5edbc commit 616b420

4 files changed

Lines changed: 50 additions & 2 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,14 @@ Default Google key file. Defaults to `$GITLAB_OBJECT_STORE_CONNECTION_GOOGLE_JSO
12361236

12371237
Cron notation for the GitLab pipeline schedule worker. Defaults to `'19 * * * *'`
12381238

1239+
##### `GITLAB_ADMIN_EMAIL_WORKER_CRON`
1240+
1241+
Cron notation for the GitLab admin email worker. Defaults to `'0 0 * * 0'`
1242+
1243+
##### `GITLAB_PERSONAL_ACCESS_TOKEN_EXPIRING_WORKER_CRON`
1244+
1245+
Cron notation for the GitLab personal access tokens expiring worker. Defaults to `'0 1 * * *'`
1246+
12391247
##### `GITLAB_LFS_ENABLED`
12401248

12411249
Enable/Disable Git LFS support. Defaults to `true`.

assets/runtime/config/gitlabhq/gitlab.yml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,11 @@ production: &base
440440
# Periodically executed jobs, to self-heal GitLab, do external synchronizations, etc.
441441
# Please read here for more information: https://github.com/ondrejbartas/sidekiq-cron#adding-cron-job
442442
cron_jobs:
443+
# Interval, in seconds, for each Sidekiq process to check for scheduled cron jobs that need to be enqueued. If not
444+
# set, the interval scales dynamically with the number of Sidekiq processes. If set to 0, disable polling for cron
445+
# jobs entirely.
446+
# poll_interval: 30
447+
443448
# Flag stuck CI jobs as failed
444449
stuck_ci_jobs_worker:
445450
cron: "0 * * * *"
@@ -449,9 +454,18 @@ production: &base
449454
# Remove expired build artifacts
450455
expire_build_artifacts_worker:
451456
cron: "50 * * * *"
457+
# Remove expired pipeline artifacts
458+
ci_pipelines_expire_artifacts_worker:
459+
cron: "*/23 * * * *"
460+
# Remove files from object storage
461+
ci_schedule_delete_objects_worker:
462+
cron: "*/16 * * * *"
452463
# Stop expired environments
453464
environments_auto_stop_cron_worker:
454465
cron: "24 * * * *"
466+
# Delete stopped environments
467+
environments_auto_delete_cron_worker:
468+
cron: "34 * * * *"
455469
# Periodically run 'git fsck' on all repositories. If started more than
456470
# once per hour you will have concurrent 'git fsck' jobs.
457471
repository_check_worker:
@@ -461,10 +475,10 @@ production: &base
461475
cron: "17 * * * *"
462476
# Send admin emails once a week
463477
admin_email_worker:
464-
cron: "0 0 * * 0"
478+
cron: "{{GITLAB_ADMIN_EMAIL_WORKER_CRON}}"
465479
# Send emails for personal tokens which are about to expire
466480
personal_access_tokens_expiring_worker:
467-
cron: "0 1 * * *"
481+
cron: "{{GITLAB_PERSONAL_ACCESS_TOKEN_EXPIRING_WORKER_CRON}}"
468482

469483
# Remove outdated repository archives
470484
repository_archive_cache_worker:
@@ -478,6 +492,18 @@ production: &base
478492
schedule_migrate_external_diffs_worker:
479493
cron: "15 * * * *"
480494

495+
# Periodically update ci_runner_versions table with up-to-date versions and status.
496+
ci_runner_versions_reconciliation_worker:
497+
cron: "@daily"
498+
499+
# Periodically clean up stale runner machines.
500+
ci_runners_stale_machines_cleanup_worker:
501+
cron: "36 * * * *"
502+
503+
# Periodically queue syncing of finished pipelines from p_ci_finished_pipeline_ch_sync_events to ClickHouse
504+
ci_click_house_finished_pipelines_sync_worker:
505+
cron: "*/4 * * * *"
506+
481507
# GitLab EE only jobs. These jobs are automatically enabled for an EE
482508
# installation, and ignored for a CE installation.
483509
ee_cron_jobs:

assets/runtime/env-defaults

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ GITLAB_TERRAFORM_STATE_OBJECT_STORE_CONNECTION_GOOGLE_JSON_KEY_LOCATION=${GITLAB
195195

196196
## Cron Jobs
197197
GITLAB_PIPELINE_SCHEDULE_WORKER_CRON=${GITLAB_PIPELINE_SCHEDULE_WORKER_CRON:-"19 * * * *"}
198+
GITLAB_ADMIN_EMAIL_WORKER_CRON=${GITLAB_ADMIN_EMAIL_WORKER_CRON:-"0 0 * * 0"}
199+
GITLAB_PERSONAL_ACCESS_TOKEN_EXPIRING_WORKER_CRON=${GITLAB_PERSONAL_ACCESS_TOKEN_EXPIRING_WORKER_CRON:-"0 1 * * *"}
198200

199201
## LFS
200202
GITLAB_LFS_ENABLED=${GITLAB_LFS_ENABLED:-true}

assets/runtime/functions

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,18 @@ gitlab_configure_cron_jobs() {
10931093
else
10941094
exec_as_git sed -i "/{{GITLAB_PIPELINE_SCHEDULE_WORKER_CRON}}/d" ${GITLAB_CONFIG}
10951095
fi
1096+
1097+
if [[ -n "${GITLAB_ADMIN_EMAIL_WORKER_CRON}" ]]; then
1098+
update_template ${GITLAB_CONFIG} GITLAB_ADMIN_EMAIL_WORKER_CRON
1099+
else
1100+
exec_as_git sed -i "/{{GITLAB_ADMIN_EMAIL_WORKER_CRON}}/d" ${GITLAB_CONFIG}
1101+
fi
1102+
1103+
if [[ -n "${GITLAB_PERSONAL_ACCESS_TOKEN_EXPIRING_WORKER_CRON}" ]]; then
1104+
update_template ${GITLAB_CONFIG} GITLAB_PERSONAL_ACCESS_TOKEN_EXPIRING_WORKER_CRON
1105+
else
1106+
exec_as_git sed -i "/{{GITLAB_PERSONAL_ACCESS_TOKEN_EXPIRING_WORKER_CRON}}/d" ${GITLAB_CONFIG}
1107+
fi
10961108
}
10971109

10981110
gitlab_configure_analytics_google() {

0 commit comments

Comments
 (0)