'GitLab job allow failure on certain exit code
I have a GitLab CI/CD job doing some stuff.
I want some executed commands to be able to fail and result in a warning for this job, but I also want other command to result in an error in the pipeline if they fail.
I have set in the .yaml file allow_failure: true
, which will always result in a warning for this job regardless of the error.
Can I tell GitLab job to output an error for a specific exit code and a warning for another ?
Solution 1:[1]
With gitlab 13.9 allow_failure:exit_codes
where introduced. With that you can now allow failure for certain exits codes and fail the job for all other ones.
allow_failure:
exit_codes:
- 137
- 255
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | danielnelz |