Version used: gitlab.com (free tier)
I have this rule on a job
rules:
- if: '$CI_PIPELINE_SOURCE == "trigger"'
when: never
The way I understand it (which is also what I want it to do), is that it should prevent the job from being added to the pipeline when the contents of variable $CI_PIPELINE_SOURCE
equals trigger
.
This is not the case, and the job in question is always removed from the pipeline.
The pipeline is triggered by an API call from another pipeline https://docs.gitlab.com/ee/ci/triggers/
What am I doing wrong ?
Edit
The variable value is displayed on the pipeline screen
I think this is the correct behaviour as per documentation here:
As in this example here you probably need to include the when: on_success
job:
script: echo "Hello, Rules!"
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success