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

-- 
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/befed8e7-cc85-4fb7-a585-bb7e31d41cb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to