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? From: Ramanathan Muthaiah [mailto:[email protected]] Sent: 21 April 2017 11:05 To: Jenkins Users <[email protected]> Cc: David Aldrich <[email protected]> Subject: Re: Pipeline jobs: How are return codes handled? On Friday, April 21, 2017 at 3:22:49 PM UTC+5:30, David Aldrich wrote: 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? Regd item 2), returnStatus will return the execution completion status of commands enclosed within "script: " It can be either 127 (if the command is not found) or 1 for failed valid command or 0 for valid command that has been executed successfully. Refer to these links for more info: https://issues.jenkins-ci.org/browse/JENKINS-26133 https://jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#code-sh-code-shell-script http://stackoverflow.com/questions/36956977/how-to-execute-a-command-in-a-jenkins-2-0-pipeline-job-and-then-return-the-stdou http://stackoverflow.com/questions/36547680/how-to-do-i-get-the-output-of-a-shell-command-executed-using-into-a-variable-fro https://support.cloudbees.com/hc/en-us/articles/218554077-How-to-set-current-build-result-in-Pipeline Click here<https://www.mailcontrol.com/sr/!Ny8HvqqFRrGX2PQPOmvUlCEUkzG4u6O7NiTBEsmeV7OgNc+cpLi7lzei5x40!sKYFa2ehQ!pypqvfHxypKb0g==> to report this email as spam. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/20a2d132608c4d7bac0918129029e45c%40EUX13SRV1.EU.NEC.COM. For more options, visit https://groups.google.com/d/optout.
