Alexej Ismailov
added a comment - 2019-03-20 10:29 - edited I'm sorry if this is a stupid question, but how do I use this? How to configure jenkins to interpret exit code 2 as unstable?
If I do this inside a step:
sh """exit 2"""
I get same behaviour as if I would exit with 1:
11:27:13 Catching error for later recovery: hudson.AbortException: script returned exit code 2
...
[Pipeline] End of PipelineERROR: script returned exit code 2
Finished: FAILURE

Aaron D. Marasco
added a comment - 2019-03-20 12:41 Alexej Ismailov all of the above examples, being from 2016, were probably using the "classic" interface which has a field in the UI. In pipeline code, you want to use the "returnStatus" flag when calling sh - see https://jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#sh-shell-script - unfortunately you cannot use "returnStdout" at the same time; see JENKINS-44930 .