Version used: gitlab.com (free tier)
I have this rule on a job
- if: '$CI_PIPELINE_SOURCE == "trigger"'
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
This is not the case, and the job in question is always removed from the pipeline.
What am I doing wrong ?
Based on CI/CD YAML syntax reference - rules:if| GitLab:
If no if statements are true, do not add the job to the pipeline.
rules are specified, jobs behave with a
when: on_success rule applied. By specifying your own rules, you need to provide conditions of when it should run.
Thanks, it worked.
But also generated a duplicate pipeline so I had to combine the
rules tag with a
workflow tag that specifies when a pipeline should run.
IMO a job should run if no rules match, and adding job rules should not force a user to add workflow rules. It is totally counter intuitive and it adds much overhead to something that should be trivial.