diff --git a/pom.xml b/pom.xml
index 4c2180d..2cb36ca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
org.jenkins-ci.plugins
plugin
- 3.54
+ 4.15
@@ -58,7 +58,7 @@
- 2.73.3
+ 2.176.4
8
2.38
maven-release-plugin:
@@ -95,7 +95,7 @@
com.axis.system.jenkins.plugins.downstream
downstream-build-cache
- 1.5.2
+ 1.6
diff --git a/scripts/codenarc_rules.txt b/scripts/codenarc_rules.txt
index bcad1bc..84a5ee5 100644
--- a/scripts/codenarc_rules.txt
+++ b/scripts/codenarc_rules.txt
@@ -131,7 +131,7 @@ ruleset {
// rulesets/dry.xml
DuplicateListLiteral
- DuplicateMapLiteral
+ // DuplicateMapLiteral Axis: Does not work for HTML-attributes in groovy
DuplicateNumberLiteral
// DuplicateStringLiteral Axis: Not very useful to us
@@ -230,7 +230,7 @@ ruleset {
ExplicitArrayListInstantiation
ExplicitCallToAndMethod
ExplicitCallToCompareToMethod
- ExplicitCallToDivMethod
+ // ExplicitCallToDivMethod Axis: Because div() is used for building html pages.
ExplicitCallToEqualsMethod
ExplicitCallToGetAtMethod
ExplicitCallToLeftShiftMethod
diff --git a/src/main/java/com/axis/system/jenkins/plugins/downstream/tree/Matrix.java b/src/main/java/com/axis/system/jenkins/plugins/downstream/tree/Matrix.java
index 3e8d642..32d9d28 100644
--- a/src/main/java/com/axis/system/jenkins/plugins/downstream/tree/Matrix.java
+++ b/src/main/java/com/axis/system/jenkins/plugins/downstream/tree/Matrix.java
@@ -113,6 +113,14 @@ public Entry(@Nullable Arrow arrow) {
this.data = null;
}
+ public Arrow getArrow() {
+ return arrow;
+ }
+
+ public T getData() {
+ return data;
+ }
+
@Override
public String toString() {
return "Entry{arrow=" + arrow + ", data=" + data + '}';
diff --git a/src/main/java/com/axis/system/jenkins/plugins/downstream/yabv/BuildFlowAction.java b/src/main/java/com/axis/system/jenkins/plugins/downstream/yabv/BuildFlowAction.java
index 4445aca..c7be75d 100644
--- a/src/main/java/com/axis/system/jenkins/plugins/downstream/yabv/BuildFlowAction.java
+++ b/src/main/java/com/axis/system/jenkins/plugins/downstream/yabv/BuildFlowAction.java
@@ -1,7 +1,5 @@
package com.axis.system.jenkins.plugins.downstream.yabv;
-import static com.axis.system.jenkins.plugins.downstream.tree.TreeLaminator.layoutTree;
-
import com.axis.system.jenkins.plugins.downstream.cache.BuildCache;
import com.axis.system.jenkins.plugins.downstream.tree.Matrix;
import com.axis.system.jenkins.plugins.downstream.tree.TreeLaminator.ChildrenFunction;
@@ -13,14 +11,6 @@
import hudson.model.Job;
import hudson.model.Queue;
import hudson.model.Run;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import javax.annotation.Nonnull;
-import javax.servlet.ServletException;
import jenkins.model.Jenkins;
import jenkins.model.TransientActionFactory;
import org.kohsuke.stapler.StaplerRequest;
@@ -28,6 +18,19 @@
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;
+import javax.annotation.Nonnull;
+import javax.servlet.ServletException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import static com.axis.system.jenkins.plugins.downstream.tree.TreeLaminator.layoutTree;
+
/**
* Produces Transient Actions for visualizing the flow of downstream builds.
*
@@ -56,6 +59,13 @@ private static final ChildrenFunction getChildrenFunc() {
};
}
+ public Run getRootUpstreamBuild() {
+ if (target == null) {
+ return null;
+ }
+ return buildFlowOptions.isShowUpstreamBuilds() ? getRootUpstreamBuild(target) : target;
+ }
+
private static Run getRootUpstreamBuild(@Nonnull Run build) {
Run parentBuild;
while ((parentBuild = getUpstreamBuild(build)) != null) {
@@ -92,7 +102,7 @@ public BuildFlowOptions getBuildFlowOptions() {
@Exported(visibility = 1)
public boolean isAnyBuildOngoing() {
return target != null
- && isChildrenStillBuilding(getRootUpstreamBuild(target), getChildrenFunc());
+ && isChildrenStillBuilding(getRootUpstreamBuild(), getChildrenFunc());
}
private static boolean isChildrenStillBuilding(Object current, ChildrenFunction children) {
@@ -136,13 +146,54 @@ public Run getTarget() {
}
public Matrix buildMatrix() {
- if (target == null) {
+ Run root = getRootUpstreamBuild();
+ if (root == null) {
return new Matrix();
}
- Run root = buildFlowOptions.isShowUpstreamBuilds() ? getRootUpstreamBuild(target) : target;
return layoutTree(root, getChildrenFunc());
}
+ /**
+ * Returns all items in the build flow, populated from the root. Which target is root depends on
+ * {@link BuildFlowOptions#isShowUpstreamBuilds()}.
+ *
+ * @param lookBack number of historic build flows to fetch, based on the root target's previous
+ * builds.
+ * @return A list of sets of Objects. Each set represents all items in a flow, starting from the
+ * root. The first set is calculated from the root, the next set is from the root target's
+ * previous build and so on.
+ */
+ public List> getAllItemsInFlow(int lookBack) {
+ Run root = getRootUpstreamBuild();
+ if (root == null) {
+ return Collections.emptyList();
+ }
+ List> result = new ArrayList<>();
+ for (; lookBack > 0 && root != null; lookBack--) {
+ Set