I have the following stages defined in my project's gitlab-config.yaml:
stages:
- Prepare
- Report
- Static Analysis
- Unit Test
- Integration Test Prep
- Integration Tests
- Deploy
The stage before Deploy is Integration Tests, and all jobs within this stage are not allowed to fail (which is the default according to the docs).
I have a number of deploy jobs that deploy to different environments. My production deploy job uses the following logic:
rules:
- if: $DEPLOY_ENV == "production" && $CI_COMMIT_BRANCH == "production"
when: always
My problem with the current setup is that even though the Integration Tests jobs are not allowed to fail, even if they do, the production deploy stage is still reached.
It appears that the use of always overrides the fact that the previous stage's jobs are not allowed to fail.
How can I prevent the production deploy job from running if any of the previous Integration Tests jobs fail?