Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nosmo committed Nov 22, 2018
1 parent ea6805b commit b4ec947
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ public String postBuildComment(Run<?, ?> build, TaskListener listener) {
FilePath workspace;
FilePath path;

// On custom pipelines, build will be an instance of WorkflowRun
if (build instanceof WorkflowRun) {
FlowExecution exec = ((WorkflowRun) build).getExecution();
if (exec == null) {
listener.getLogger().println("build was instanceof WorkflowRun but executor was null");
} else {
// We walk the execution flow as a run can have multiple workspaces
FlowGraphWalker w = new FlowGraphWalker(exec);
for (FlowNode n : w) {
if (n instanceof BlockStartNode) {
Expand All @@ -69,6 +71,8 @@ public String postBuildComment(Run<?, ?> build, TaskListener listener) {
listener.getLogger().println("Remote path is " + node + ":" + nodepath + "\n");

if (action.getWorkspace() == null) {
// if the workspace returns null, the workspace either isn't here or it doesn't
// exist - in that case, we fail over to trying to find the comment file locally.
continue;
}

Expand All @@ -88,6 +92,7 @@ public String postBuildComment(Run<?, ?> build, TaskListener listener) {
}
}
} else if (build instanceof Build<?, ?>) {
// When using workers on hosts other than master, we simply get the workspace here.
workspace = ((Build<?, ?>) build).getWorkspace();
path = workspace.child(scriptFilePathResolved);

Expand Down

0 comments on commit b4ec947

Please sign in to comment.