pipeline: Retrieve exit Code from 'sh' step and perform logic

387 views
Skip to first unread message

John Engelman

unread,
May 19, 2016, 2:55:24 PM5/19/16
to Jenkins Users
Is there a way to perform conditional logic in my pipeline based on the exit code from a 'sh' step?
Basically, I want to execute different behavior based on that. In this case it is Terraform which will output different exit codes based on the results of a 'terraform plan'

John Engelman

unread,
May 19, 2016, 6:29:22 PM5/19/16
to Jenkins Users
I finally found this (https://issues.jenkins-ci.org/browse/JENKINS-26133) which addresses my issue.

Lars.M...@edict.de

unread,
May 20, 2016, 3:10:02 AM5/20/16
to jenkins...@googlegroups.com
Good to know that there is some kind of issue to make that more handy. My first thought was to catch the exception that occurs on exit code non zero.

--
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
jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/21a894c4-597d-4937-92e1-d7d71c66186d%40googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages