"fast finish" option in CI/CD pipelines with jobs that are allowed to fail
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Problem to solve
If a pipeline has jobs that are allowed to fail (allow_failure: true), then the pipeline should be marked successful as soon as all other jobs have completed if fast_finish: true is specified on the pipeline. Also, a stage should be completed as soon as all other jobs that must succeed in that stage have completed if fast_finish: true is specified on the pipeline.
Further details
The best way I can explain this is linking to the feature provided by Travis CI https://docs.travis-ci.com/user/customizing-the-build/#fast-finishing
Proposal
Here's how a .gitlab-ci.yml definition would look:
fast_finish: true
build:
stage: build
script:
- run the build
test:
stage: test
script:
- run core tests
# it is ok if this job fails, and we should not wait for it to succeed
code_quality:
stage: test
allow_failure: true
script:
- run codequality
release:
stage: deploy
script:
- release code
# it is ok if this job fails, and we should not wait for it to succeed
other_release_task:
stage: deploy
allow_failure: true
script:
- other release task
When this pipeline runs:
- the
buildstage should require thebuildjob to succeed - the
teststage should require thetestjob to succeed - as soon as the
testjob succeeds, thedeploystage should start (regardless of the status of thecode_qualityjob) - the
deploystage should require thereleasejob to succeed - as soon as the
releasejob succeeds, the pipeline should be marked success (regardless of the status of theother_release_taskjob)
Edited by 🤖 GitLab Bot 🤖