Skip to content
This repository has been archived by the owner on Dec 10, 2019. It is now read-only.

Commit

Permalink
Merged changes from #36 in release-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Karsten Kraus authored and Karsten Kraus committed Aug 24, 2017
1 parent 7450cc4 commit e7d4bf0
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
import hudson.model.Run;
import hudson.model.TaskListener;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.plugins.workflow.actions.ErrorAction;
import org.jenkinsci.plugins.workflow.cps.nodes.StepEndNode;
import org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode;
import org.jenkinsci.plugins.workflow.flow.FlowExecution;
import org.jenkinsci.plugins.workflow.flow.GraphListener;
import org.jenkinsci.plugins.workflow.graph.FlowNode;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
import org.jenkinsci.plugins.workflow.steps.FlowInterruptedException;

import java.io.IOException;
import java.io.Serializable;
Expand Down Expand Up @@ -128,7 +130,16 @@ public void onNewHead(FlowNode node) {
if (isNamedStageStartNode(node)) {
publishBuildStatus(build, metadata, running, getRunningContexts().push(node), "");
} else if (isStageEndNode(node, getRunningContexts().peekNodeId())) {
publishBuildStatus(build, metadata, success, getRunningContexts().pop(), "");
ErrorAction error = node.getError();
if (error != null) {
if (error.getError() instanceof FlowInterruptedException) {
publishBuildStatus(build, metadata, canceled, getRunningContexts().pop(), "");
} else {
publishBuildStatus(build, metadata, failed, getRunningContexts().pop(), "");
}
} else {
publishBuildStatus(build, metadata, success, getRunningContexts().pop(), "");
}
}
}

Expand Down Expand Up @@ -192,4 +203,4 @@ Collection<String> clear() {
return names;
}
}
}
}

0 comments on commit e7d4bf0

Please sign in to comment.