Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to schedule gitlab pipeline in less than an hour?

I try to set up a scheduled pipeline that runs every 20 mins. I use the customized cron syntax (*/20 * * * *) in the setting, but gitlab doesn't honor this and still runs it every hour.

Is this a gitlab bug or did I miss something?

like image 316
piggybox Avatar asked Dec 07 '22 13:12

piggybox


2 Answers

Check out GitLab schedules: it does mention:

The pipelines won't be executed precisely, because schedules are handled by Sidekiq, which runs according to its interval.

For example, if you set a schedule to create a pipeline every minute (* * * * *) and the Sidekiq worker runs on 00:00 and 12:00 every day (0 */12 * * *), only 2 pipelines will be created per day.

To change the Sidekiq worker's frequency, you have to edit the pipeline_schedule_worker_cron value in your gitlab.rb and restart GitLab.

like image 126
VonC Avatar answered Dec 18 '22 00:12

VonC


New way for 12.8.X

To change the Sidekiq worker’s frequency: Edit the gitlab_rails['pipeline_schedule_worker_cron'] value in your instance’s gitlab.rb file. The exact line I have checked from gitlab.rb file is

# gitlab_rails['pipeline_schedule_worker_cron'] = "19 * * * *"

So uncomment the line and for example to run every minute do this.

gitlab_rails['pipeline_schedule_worker_cron'] = "* * * * *"

Reconfigure GitLab for the changes to take effect. Then go to job and add this in your job schedule, in this example it will run every 5 minutes :

*/5 * * * *

Older version 10.x.x the good way is. Edit the gitlab_ci['schedule_builds_minute'] = "0" value in your instance’s gitlab.rb file.

Please check the the official page, it's changing offen https://docs.gitlab.com/ce/user/project/pipelines/schedules.html#advanced-configuration

like image 32
rab Avatar answered Dec 17 '22 22:12

rab