Skip to content

Commit

Permalink
Only add WarningAction when propagate: true
Browse files Browse the repository at this point in the history
Update test
  • Loading branch information
stuartrowe committed Apr 5, 2023
1 parent 6c912a4 commit 1ca3981
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void onCompleted(Run<?,?> run, @NonNull TaskListener listener) {
Result result = run.getResult();
try {
context.get(TaskListener.class).getLogger().println("Build " + ModelHyperlinkNote.encodeTo("/" + run.getUrl(), run.getFullDisplayName()) + " completed: " + result.toString());
if (result.isWorseThan(Result.SUCCESS)) {
if (action.propagate && result.isWorseThan(Result.SUCCESS)) {
context.get(FlowNode.class).addOrReplaceAction(new WarningAction(result));
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class WaitForBuildStepTest {
us.setDefinition(new CpsFlowDefinition(
"def ds = build job: 'ds', waitForStart: true\n" +
"def dsRunId = \"${ds.getFullProjectName()}#${ds.getNumber()}\"\n" +
"def completeDs = waitForBuild runId: dsRunId\n" +
"def completeDs = waitForBuild runId: dsRunId, propagate: true\n" +
"echo \"'ds' completed with status ${completeDs.getResult()}\"", true));
j.assertLogContains("'ds' completed with status UNSTABLE", j.buildAndAssertSuccess(us));
WorkflowRun lastUpstreamRun = us.getLastBuild();
Expand Down

0 comments on commit 1ca3981

Please sign in to comment.