I am trying to create a two-stage job in Jenkins. I want the second step to be performed only if the first step failed. (The first step runs a unit test to make sure that the code I'm compiling is good - if it isn't, I want to run some diagnostics in the second step).
The conditional step plug seems to be a good choice for this. However, I cannot figure out how to use the conditional step plug to force the second step to start when the first step fails.
The conditional step step offers a list of conditions, such as "Never", "Logical condition" ... and "Current build status". I would have thought that I should use the condition “Current build state” and set the worst status to “failure” and the best status to “unstable”. Then, if the first step fails, the second step will be performed.
However, there seems to be a problem with this. When the first step fails, then Jenkin stops work at this point. Thus, in the second stage it will never be possible to assess his condition and see if it will work.
Thus, I do not see how the use of the “current assembly status” can be used in the plugin of the conditional step - as if the assembly had already failed, we never get to the Conditional step. How can I mark the build status as unsuccessful in step 1, but did not start Jenkins work at this point?
many thanks
Dave Sinclair
source
share