diff --git a/plugin/src/main/java/io/jenkins/plugins/analysis/core/model/SummaryModel.java b/plugin/src/main/java/io/jenkins/plugins/analysis/core/model/SummaryModel.java
index aefe320383..15f97f9c70 100644
--- a/plugin/src/main/java/io/jenkins/plugins/analysis/core/model/SummaryModel.java
+++ b/plugin/src/main/java/io/jenkins/plugins/analysis/core/model/SummaryModel.java
@@ -10,6 +10,7 @@
import hudson.model.Run;
+import io.jenkins.plugins.forensics.reference.ReferenceBuild;
import io.jenkins.plugins.util.QualityGateStatus;
/**
@@ -155,6 +156,20 @@ public boolean isResetQualityGateVisible() {
return analysisResult.getReferenceBuild();
}
+ /**
+ * Renders the reference build as an HTML link.
+ *
+ * @return the reference build
+ * @see #getReferenceBuild()
+ */
+ @SuppressWarnings("unused") // Called by jelly view
+ public String getReferenceBuildLink() {
+ return facade.getReferenceLink(
+ analysisResult.getReferenceBuild()
+ .map(Run::getExternalizableId)
+ .orElse("-"));
+ }
+
public boolean isZeroIssuesHighscore() {
return getNoIssuesSinceBuild() > 0 && analysisResult.getOwner().getNumber() > getNoIssuesSinceBuild();
}
@@ -175,5 +190,9 @@ static class LabelProviderFactoryFacade {
public StaticAnalysisLabelProvider get(final String id) {
return new LabelProviderFactory().create(id);
}
+
+ public String getReferenceLink(final String id) {
+ return ReferenceBuild.getReferenceBuildLink(id);
+ }
}
}
diff --git a/plugin/src/main/resources/io/jenkins/plugins/analysis/core/model/ResultAction/summary.jelly b/plugin/src/main/resources/io/jenkins/plugins/analysis/core/model/ResultAction/summary.jelly
index 6ac50b9b57..12ccbeb45e 100644
--- a/plugin/src/main/resources/io/jenkins/plugins/analysis/core/model/ResultAction/summary.jelly
+++ b/plugin/src/main/resources/io/jenkins/plugins/analysis/core/model/ResultAction/summary.jelly
@@ -99,7 +99,7 @@