I'm using the env variable "currentBuild.result" to modify the overall job status of a Jenkins job.
I can set it to a failure using
currentBuild.result = 'FAILURE'
and I can set it to Aborted using
currentBuild.result = 'ABORTED'
but I cannot clear these back to success using
currentBuild.result = 'SUCCESS'
This is driving me nuts, Any idea what I'm doing wrong here and any pointers on how to set the overall job status to Success after they have been set to some other state?
Appreciate any pointers in advance!
Alternatively you can call error(String message) step to stop the pipeline and set its status to FAILED . For example, if your stage 1 calls error(msg) step like: stage("Stage 1") { steps { script { error "This pipeline stops here!" } } }
You can only set build status to worse than it value. Meaning you can set SUCCESS -> ABORTED, but can't set FAILED -> SUCCESS.
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