DevOps / GitLab CI Basics Interview Questions
What is the 'allow_failure' keyword and how does it affect pipeline status?
The allow_failure keyword controls whether a failing job causes the pipeline to fail. When set to true, the job can fail without marking the overall pipeline as failed - GitLab shows a warning icon on the job instead of a failure.
# allow_failure: true - job failure does not fail the pipeline linting: stage: test script: - eslint src/ --max-warnings 0 allow_failure: true # linting warnings won't block deployment # allow_failure with rules (preferred modern approach) code-quality: stage: test script: - run-quality-check.sh rules: - if: $CI_COMMIT_BRANCH allow_failure: true - if: $CI_COMMIT_TAG allow_failure: false # strict on releases # allow_failure with exit codes # Only allow specific non-zero exit codes: flaky-test: script: - run-flaky-tests.sh allow_failure: exit_codes: 137 # allow OOM kills (exit code 137) # allow_failure: true with manual jobs # makes the manual job non-blocking optional-deploy: when: manual allow_failure: true # pipeline passes without triggering this job
| allow_failure | Job fails | Pipeline result |
|---|---|---|
| false (default) | Yes | Pipeline fails |
| true | Yes | Pipeline passes with warning icon |
| exit_codes: [N] | Exit code N | Pipeline passes; other codes still fail pipeline |
More Related questions...