Hi
In a conventional Jenkins job, my understanding is that the job will fail if the last command of a shell build step indicates an error.
I am now experimenting with pipeline jobs and have something like:
node {
stage('Checkout') {<snip>}
sh returnStatus: true, script: '''cd software
make cleanall
make '''
}
I am not sure what is happening here.
1) Will the same rule apply that the job will fail if the last command of the sh step fails?
2) What is ‘returnStatus: true, script’ doing?
Best regards
David
Thanks for your reply but I am still confused. Looking at:
https://jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#code-sh-code-shell-script
returnStatus (optional)
Normally, a script which exits with a nonzero status code will cause the step to fail with an exception. If this option is checked, the return value of the step will instead be the status code. You may then compare it to zero, for example.
So if I specify that option I get the status code, but will Jenkins fail the pipeline if the code is non-zero or do I have to do that myself?
If I don’t specify that option I will get an exception on a failure. Will that fail the job neatly or will I get an exception trace?
Click here to report this email as spam.