Support `interruptible` in CI config job rules
What does this MR do and why?
This MR adds the ability to override a job's interruptible
value using rules.
Resolves #194023 (closed).
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
- First let's observe what happens when a job's rules does not override its
interruptible
value. Commit the following change to your project's.gitlab-ci.yml
and then make another commit (within 60 seconds) to the same branch.
job:
interruptible: true
script: sleep 60
- Step 1 would have triggered two pipelines, the first of which should be canceled because
interruptible: true
.
- Now commit the following to your
.gitlab-ci.yml
and again make another commit (within 60 seconds) to the same branch.
job:
interruptible: true
script: sleep 60
rules:
- if: $EMPTY == null # true
interruptible: false
- Step 3 would again trigger two pipelines except this time the first pipeline does not get canceled. This confirms that the job's
interruptible
value was overridden by the rule and updated tofalse
.
- Since
interruptible
can also be set at the default level, we can repeat Step 3 with the following config. The output should be the same as in Step 4.
default:
interruptible: true
job:
script: sleep 60
rules:
- if: $EMPTY == null # true
interruptible: false
Related to #194023 (closed)
Edited by Leaminn Ma