Allow defining scheduled pipelines triggers as yaml
Proposal
Currently, pipelines can only be triggered on a schedule using the UI (CI/CD -> Schedules), or REST API. Ideally, it should be possible to define schedules in the .gitlab-ci.yml
file. This has several benefits, but most importantly, we can use a single schedule definition and share it with other projects using include
. This also complies with our policies to define (as much as possible) "as code".
See: https://support.gitlab.com/hc/en-us/requests/182472
Intended users
Proposal
Add a new top-level schedules
keyword that allows defining multiple schedules directly from code. Proposed syntax:
schedules:
- name: Schedule name
cron: * * * * *
timezone: UTC # could come in future iteration
target_branch: main
variables: {} # could come in future iteration
Required fields:
name
cron
Field with defaults values:
-
timezone
: Defaults toUTC
-
target_branch
: Defaults toCI_DEFAULT_BRANCH
-
variables
: Defaults to an empty block{}
Design ideas/questions
- Which takes precedence in case of conflict between
schedules
block in thegitlab-ci.yml
, schedules in UI or defined through the API? The last schedule change takes precedence
Edited by Dov Hershkovitch