firefoxgitlab-cidevopscicdnightly-build

Nightly build specific job does not get triggered


I have multi project pipelines and within my downstream pipeline (e2e) I have defined a chrome job which runs on every push, merge request and nightly scheduled pipeline. I created an almost identical firefox job that I want to run only on the nightly pipeline. The caveat is that upon logging the predefined gitlab variables during the install phase, I saw that the nightly pipeline has CI_PIPELINE_SOURCE = pipeline, instead of scheduled, and this is where all problems arose for me.

The issue is that the firefox job either gets triggered everywhere, or does not get triggered at all.

I tried using

rules:
 - changes
  - scheduled
when: always
- when: manual

and this results in the firefox job having to be triggered manually everytime.

I tried using

rules:
 - if: '$CI_PIPELINE_SOURCE == "schedule"'

but this just disregards the firefox job in the nightly pipeline because the CI_PIPELINE_SOURCE is pipeline.

I tried using a custom variable by defining it both in my nightly test job using the gitlab UI (variable name: FIREFOX, value: true) and in my gitlab-ci.yml file

variables:
FIREFOX: false

then in my firefox job I added

rules:
 - if: $FIREFOX == "true"

and this didn't work either.

What am I missing?


Solution

  • I managed to run the Firefox job in two ways.

    1. Create a schedule for the e2e project itself, that way the CI_PIPELINE_SOURCE is schedule, and the rule applies.

    2. Create a custom variable on the gitlab UI where the client and server schedules are. By defining a variable there (FIREFOX = true) and having a rule in my gitlab-ci.yml file to run the job only when $FIREFOX == true solved the issue. I had to define the variable in my variables like so:

     variables:
     FIREFOX: ${FIREFOX:-false}
    

    When the e2e project gets triggered by the client/server as a downstream pipeline, its CI_PIPELINE_SOURCE is pipeline. The triggering pipeline source, i.e. the CI_PIPELINE_SOURCE of the client/server is schedule. That's why it wasn't working with the approach from the question.