Multiple schedule pipelines (solved)

I have a daily and a weekly schedule pipeline and depending on which one runs I want to select the jobs included.
So I’m doing the following:

    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_PIPELINE_SOURCE == "schedule"

  stage: test
    - if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_SCHED_FREQ == "daily"'
    - echo "This is the before_script of the .template_daily job"

  stage: test
    - if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_SCHED_FREQ == "weekly"'
    - echo "This is the before_script of the .template_weekly job"

  extends: .template_daily
    - echo "Run on $CI_SCHED_FREQ schedule"

  extends: .template_weekly
    - echo "Run on $CI_SCHED_FREQ schedule"

    - echo "Run on merge_request_event and schedule"

The CI_SCHED_FREQ is a variable set by the schedule pipeline
I expect that test:daily will run together with test:any on the daily schedule, while the test:weekly will run with test:any on a weekly schedule. On merge requests only test:any should be able to run, since the $CI_SCHED_FREQ is not set.

None of the test:daily or test:weekly is run, only the test:any is run.
I’ve tried changing the rules, removing the templates and sticking the rules in the jobs directly, played with and without quotes around the entire rule expression, none of that worked.

I was trying to use the documentation here:

and specifically this instructions:

  script: echo "This job does NOT create double pipelines!"
    - if: '$CUSTOM_VARIABLE == "true" && $CI_PIPELINE_SOURCE == "merge_request_event"'

the logic should be exactly the same, but for some reason the job does not start.

Maybe an important detail, I’m running on 14.10 self-managed.

What am I doing wrong?

EDIT: the original sin was in the schedule pipeline configuration where the variable was set to “daily” with the quotes, while it should have been without the quotes. Unclear why the quotes caused so much troubles, apparently their usage is not entirely clear in the documentation, or maybe I missed that part.

Hi @al.basili

I am not able to replicate on, jobs are started as you expect. So such setup was either fixed or not supported in 14.10.
For such old version of GitLab I recommend to avoid workflow and set the rules in the jobs directly.

Hi @balonik , apologies for the noise, I’ve found the issue in the schedule pipeline definition (see my EDIT in the OP). Thanks for your feedback.

1 Like