I mean to get this status:
I can finish my job with failure, by "exit 1" , but can't do the same with warning
Run jobs for scheduled pipelines To configure a job to be executed only when the pipeline has been scheduled, use the rules keyword.
It might be a security vulnerability. The code in your most recent commit could be vulnerable, or a dependency could be at risk, either of which would trigger a failed security test and thus a failed pipeline.
Warnings in Gitlab aren't an exit status you can control from within the job, but a configuration option for the job itself. In the .gitlab-ci.yml
file, you need to add the flag allow_failure
:
somejob:
stage: test
script:
- some_script
allow_failure: true
If this job then fails (i.e., terminates with an exit code that isn't 0
), it will end with a warning status and not block the pipeline from continuing.
This is possible since 13.8:
test_job:
script:
- execute_script_that_will_fail
# if the script exit code is 137 or 255 the job will allow to be
# failed and the pipeline will continue to run
allow_failure:
exit_codes: # User defined exit code
- 137
- 255
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With