Skip to content

Add a way to automatically manage pipeline schedules

This allows to automate the management of the pipeline schedules. The relevant part of the README explains it well (hopefully):

Schedules are managed automatically by the schedules-sync job which runs for every non-scheduled master commit. A dry-run:schedules-sync job also runs on any non-master pipeline.

These jobs run the bin/manage_schedules script, which allows to sync pipeline schedules and their variables.

Additionally, it will automatically disable all the pipeline schedules that aren't declared.

Schedules are defined in the pipeline-schedules.yml file. Its format is as follows:

---
gitlab-org:
  base:
    cron: '0 4 * * 1-5'
    variables:
      TRIAGE_SOURCE_TYPE: groups
      TRIAGE_SOURCE_PATH: 9970
  variants:
    - id: 11219
      description: 'gitlab-org group label community contributions'
      ref: 'feature'
      cron: '0 4 * * 1-7'
      cron_timezone: 'Europe'
      active: true
      variables:
        RUN_SINGLE: 1
        TRIAGE_POLICY_FILE: 'policies/label-community-contributions.yml'
    - active: false
      variables:
        RUN_SINGLE: 1
        TRIAGE_POLICY_FILE: 'policies/stage-and-group-labels-hygiene.yml'
  1. base are shared attributes and variables for all the variants of a schedule.
    • Supported attributes are description, ref, cron, cron_timezone, active.
  2. variants is an array of variants for which you can define/override attributes and variables (e.g. useful to define a daily and a weekly job for the same group/project)
    • Supported attributes are id, description, ref, cron, cron_timezone, active.
    • Defining an id allows to update an existing pipeline schedule description, otherwise it would be impossible since pipeline schedules are matched based on their description if no id is provided.
  3. If description is omitted, it will use a default description of [MANAGED] <schedule key> (<variables list>), e.g. for the second variant in the above example, that would be [MANAGED] 'gitlab-org' ('RUN_SINGLE=1', 'TRIAGE_POLICY_FILE=policies/stage-and-group-labels-hygiene.yml').
  4. Other attributes also have a default value:
    • ref='master'
    • cron_timezone='UTC'
    • cron='0 0 * * 1-5' (Monday to Friday at midnight)
    • active=true
  5. To temporarily disable a pipeline schedule, just set active: false.

Closes #346 (closed).

Edited by Rémy Coutable

Merge request reports