Pipeline schedules (FREE)
Pipelines are normally run based on certain conditions being met. For example, when a branch is pushed to repository.
Pipeline schedules can be used to also run pipelines at specific intervals. For example:
- Every month on the 22nd (cron example:
0 0 22 * *) for a certain branch.
- Every month on the 2nd Monday (cron example:
0 0 * * 1#2).
- Every other Sunday at 0900 hours (cron example:
0 9 * * sun%2).
- Once every day (cron example:
0 0 * * *).
In addition to using the GitLab UI, pipeline schedules can be maintained using the Pipeline schedules API.
In order for a scheduled pipeline to be created successfully:
- The schedule owner must have permissions to merge into the target branch.
- The pipeline configuration must be valid.
Otherwise the pipeline is not created.
Configuring pipeline schedules
To schedule a pipeline for project:
- Navigate to the project's CI/CD > Schedules page.
- Click the New schedule button.
- Fill in the Schedule a new pipeline form.
- Click the Save pipeline schedule button.
NOTE: Pipelines execution timing is dependent on Sidekiq's own schedule.
In the Schedules index page you can see a list of the pipelines that are scheduled to run. The next run is automatically calculated by the server GitLab is installed on.
You can pass any number of arbitrary variables. They are available in
GitLab CI/CD so that they can be used in your
To configure a job to be executed only when the pipeline has been
scheduled, use the
In this example,
make world runs in scheduled pipelines, and
runs in branch and tag pipelines:
job:on-schedule: rules: - if: $CI_PIPELINE_SOURCE == "schedule" script: - make world job: rules: - if: $CI_PIPELINE_SOURCE == "push" script: - make build
Advanced configuration (FREE SELF)
Scheduled pipelines can be configured with any cron value, but they do not always run exactly when scheduled. An internal process, called the pipeline schedule worker, queues all the scheduled pipelines, but does not run continuously. The worker runs on its own schedule, and scheduled pipelines that are ready to start are only queued the next time the worker runs. Scheduled pipelines can't run more frequently than the worker.
The default frequency of the pipeline schedule worker is
3-59/10 * * * * (every ten minutes,
0:23, and so on). The default frequency for GitLab.com
is listed in the GitLab.com settings.
To change the frequency of the pipeline schedule worker:
- Edit the
gitlab_rails['pipeline_schedule_worker_cron']value in your instance's
- Reconfigure GitLab for the changes to take effect.
For example, to set the maximum frequency of pipelines to twice a day, set
to a cron value of
0 */12 * * * (
12:00 every day).
Working with scheduled pipelines
After configuration, GitLab supports many functions for working with scheduled pipelines.
Introduced in GitLab 10.4.
To trigger a pipeline schedule manually, click the "Play" button:
This schedules a background job to run the pipeline schedule. A flash message provides a link to the CI/CD Pipeline index page.
NOTE: To help avoid abuse, users are rate limited to triggering a pipeline once per minute.
Pipelines are executed as a user, who owns a schedule. This influences what projects and other resources the pipeline has access to.
If a user does not own a pipeline, you can take ownership by clicking the Take ownership button. The next time a pipeline is scheduled, your credentials are used.
If the owner of a pipeline schedule cannot create pipelines on the target branch, the schedule stops creating new pipelines.
This can happen if, for example:
- The owner is blocked or removed from the project.
- The target branch or tag is protected.
In this case, someone with sufficient privileges must take ownership of the schedule.