Skip to content
Permalink
Browse files
Retry getLastAction until build is complete
A builds change actions will not be available until
after SCM checkout. In cases of executor starvation
this can result in infinite queuing. This
works around JENKINS-40722 to provide concurrent
builds with P4 polling/Perforce Triggered Builds
  • Loading branch information
rpocase committed Nov 17, 2017
1 parent 52bc05a commit c0812f03e85c93d817fac65b21e9df230add5669
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/main/java/org/jenkinsci/plugins/p4/tagging/TagAction.java
@@ -257,7 +257,14 @@ public Label getLabel(String tag) {
public static List<P4Ref> getLastChange(Run<?, ?> run, TaskListener listener, String syncID) {
List<P4Ref> changes = new ArrayList<>();

List<TagAction> actions = lastActions(run);
List<TagAction> actions;
// Check for actions until the build is complete
// Workaround for JENKINS-40722
do {
actions = lastActions(run);
} while(actions == null && run.isBuilding());


if (actions == null || syncID == null || syncID.isEmpty()) {
listener.getLogger().println("No previous build found...");
return changes;
@@ -305,6 +312,7 @@ public static TagAction getLastAction(Run<?, ?> run) {

// get last action, if no previous action then build now.
List<TagAction> actions = run.getActions(TagAction.class);

if (actions.isEmpty()) {
return null;
}

0 comments on commit c0812f0

Please sign in to comment.