From b736e1d4a8c51ae46d9f0e381bf62c19a334cf44 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Mon, 2 Aug 2021 17:24:32 -0700 Subject: [PATCH] [JENKINS-66269] jenkinsci/pipeline-build-step-plugin#57 precludes usage of the API --- .../steps/build/DownstreamFailureCause.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/DownstreamFailureCause.java b/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/DownstreamFailureCause.java index 067a5143..667d7238 100644 --- a/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/DownstreamFailureCause.java +++ b/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/DownstreamFailureCause.java @@ -26,6 +26,7 @@ import hudson.console.ModelHyperlinkNote; import hudson.model.Run; +import hudson.model.TaskListener; import javax.annotation.CheckForNull; import jenkins.model.CauseOfInterruption; @@ -46,11 +47,22 @@ public final class DownstreamFailureCause extends CauseOfInterruption { return Run.fromExternalizableId(id); } - @Override public String getShortDescription() { + @Override public void print(TaskListener listener) { + String description; Run downstream = getDownstreamBuild(); if (downstream != null) { // encodeTo(Run) calls getDisplayName, which does not include the project name. - return ModelHyperlinkNote.encodeTo("/" + downstream.getUrl(), downstream.getFullDisplayName()) + " completed with status " + downstream.getResult() + " (propagate: false to ignore)"; + description = ModelHyperlinkNote.encodeTo("/" + downstream.getUrl(), downstream.getFullDisplayName()) + " completed with status " + downstream.getResult() + " (propagate: false to ignore)"; + } else { + description = "Downstream build was not stable (propagate: false to ignore)"; + } + listener.getLogger().println(description); + } + + @Override public String getShortDescription() { + Run downstream = getDownstreamBuild(); + if (downstream != null) { + return downstream.getFullDisplayName() + " completed with status " + downstream.getResult() + " (propagate: false to ignore)"; } else { return "Downstream build was not stable (propagate: false to ignore)"; }