Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 428
SoaAlex Avatar asked May 11 '26 19:05

SoaAlex


1 Answers

With gitlab 13.9 allow_failure:exit_codes were introduced. With that you can now allow failure for certain exit codes and fail the job for all other ones.

  allow_failure:
    exit_codes:
      - 137
      - 255
like image 162
danielnelz Avatar answered May 14 '26 08:05

danielnelz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!