Skip to content

Commit

Permalink
[FIXED JENKINS-47928] Skip parallel stage post for previous errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Tad Fisher committed Nov 9, 2017
1 parent 7b517d7 commit 9089754
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -177,6 +177,7 @@ public class ModelInterpreter implements Serializable {

def evaluateStage(Root root, Agent parentAgent, Stage thisStage, Throwable firstError, Stage parentStage = null) {
return {
def thisError = null
script.stage(thisStage.name) {
try {
if (firstError != null) {
Expand Down Expand Up @@ -228,9 +229,13 @@ public class ModelInterpreter implements Serializable {
if (firstError == null) {
firstError = e
}
thisError = e
} finally {
// And finally, run the post stage steps if this was a parallel parent.
if (thisStage.parallel != null && root.hasSatisfiedConditions(thisStage.post, script.getProperty("currentBuild"))) {
// JENKINS-47928: Do not run if the error was not thrown from this stage
if (thisError != null &&
thisStage.parallel != null &&
root.hasSatisfiedConditions(thisStage.post, script.getProperty("currentBuild"))) {
Utils.logToTaskListener("Post stage")
firstError = runPostConditions(thisStage.post, thisStage.agent ?: parentAgent, firstError, thisStage.name)
}
Expand Down

0 comments on commit 9089754

Please sign in to comment.