Add support for `when: always` on conditional includes
What does this MR do and why?
In !122810 (merged), we added support for when: never
on conditional includes. This MR adds support for when: always
, which has the same behaviour as when you do not specify when
.
The file is included into the pipeline if:
- If a rule match and a
when:
value is not set. - If a rule matches and has
when: always
.
If there are no rules, the file is included as expected. Also note that when: null
behaves the same as not specifying when:
.
Feature flag: ci_support_include_rules_when_never
Implementation:
- Step 1: Add support for `when: never` on conditional in... (!122810 - merged)
- Step 2: This MR
Resolves #348146 (closed).
How to set up and validate locally
- Add two config files to your project root:
config1.yml
:
job1:
script: echo
config2.yml
:
job2:
script: echo
- Turn on the Feature Flag:
Feature.enable(:ci_support_include_rules_when_never)
. - Update your
.gitlab-ci.yml
file with the following contents:
include:
- local: config1.yml
rules:
- if: $VAR == null
when: always
- local: config2.yml
rules:
- if: $VAR == null
job0:
script: echo
- Run the pipeline and observe that all 3 jobs are present.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #348146 (closed)
Edited by Leaminn Ma