-
Bug
-
Resolution: Fixed
-
Major
-
None
-
p4-plugin 1.3.9 from master on github and pipeline 1.15.
When using a Jenkinsfile in perforce with the p4-plugin I polling of the jenkinsfile always succeeds.
Looking at the code the problem seems to be that p4 cstat always finds a single entry, the last changelist, marked with "need". This means that the poll always finds changes and triggers a build.
As the Jenkinsfile is only polled on "master" I introduced a workaround which works for us as all other polling is done on slaves:
diff --git a/src/main/java/org/jenkinsci/plugins/p4/PerforceScm.java b/src/main/java/org/jenkinsci/plugins/p4/PerforceScm.java index 1c12e4f..87fc233 100644 --- a/src/main/java/org/jenkinsci/plugins/p4/PerforceScm.java +++ b/src/main/java/org/jenkinsci/plugins/p4/PerforceScm.java @@ -197,6 +197,11 @@ public class PerforceScm extends SCM { nodeName = (nodeName.isEmpty()) ? "master" : nodeName; envVars.put("NODE_NAME", envVars.get("NODE_NAME", nodeName)); + if (nodeName.equals("master")) { + log.println("P4: Polling disabled on master..."); + return PollingResult.NO_CHANGES; + } + Workspace ws = (Workspace) workspace.clone(); ws.setExpand(envVars);
With this things are good enough for the moment, but understanding why cstat always returns need on the script file would be good. One thing I noted is that the workspace has no root set, maybe because the format of the script workspace is "workspace@script" which is not a valid root for a workspace in perforce?
- is related to
-
JENKINS-32523 P4 plugin keeps triggering builds on the same Perforce changelist, even if no new changelist was submitted to Perforce.
-
- Closed
-
-
JENKINS-32518 Populate option "Forced clean and sync" causes continual rebuilds
-
- Closed
-