Pipeline schedules
Notes:
- Introduced in GitLab 9.1 as Trigger Schedule.
- Renamed to Pipeline Schedule in GitLab 9.2.
- Cron notation is parsed by Fugit.
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 for a certain branch.
- Once every day.
In addition to using the GitLab UI, pipeline schedules can be maintained using the Pipeline schedules API.
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.
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.
Using variables
Introduced in GitLab 9.4.
You can pass any number of arbitrary variables and they will be available in
GitLab CI so that they can be used in your .gitlab-ci.yml
file.
Using only and except
To configure that a job can be executed only when the pipeline has been scheduled (or the opposite), you can use only and except configuration keywords.
For example:
job:on-schedule:
only:
- schedules
script:
- make world
job:
except:
- schedules
script:
- make build
Advanced configuration
The pipelines won’t be executed exactly on schedule because schedules are handled by Sidekiq, which runs according to its interval.
For example, only two pipelines will be created per day if:
- You set a schedule to create a pipeline every minute (
* * * * *
). - The Sidekiq worker runs on 00:00 and 12:00 every day (
0 */12 * * *
).
To change the Sidekiq worker’s frequency:
- Edit the
gitlab_rails['pipeline_schedule_worker_cron']
value in your instance’sgitlab.rb
file. - Restart GitLab.
For GitLab.com, refer to the dedicated settings page.
Working with scheduled pipelines
Once configured, GitLab supports many functions for working with scheduled pipelines.
Running manually
Introduced in GitLab 10.4.
To trigger a pipeline schedule manually, click the “Play” button:
This will schedule a background job to run the pipeline schedule. A flash message will provide a link to the CI/CD Pipeline index page.
Taking ownership
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 will be used.
Help and feedback
If there's something you don't like about this feature
To propose functionality that GitLab does not yet offer
To further help GitLab in shaping new features
If you didn't find what you were looking for
If you want help with something very specific to your use case, and can use some community support
POST ON GITLAB FORUM
If you have problems setting up or using this feature (depending on your GitLab subscription)
REQUEST SUPPORT
To view all GitLab tiers and features or to upgrade
If you want to try all features available in GitLab.com
If you want to try all features available in GitLab self-managed
If you spot an error or a need for improvement and would like to fix it yourself in a merge request
EDIT THIS PAGE
If you would like to suggest an improvement to this doc