Details
-
Type:
Bug
-
Status: Resolved (View Workflow)
-
Priority:
Major
-
Resolution: Fixed
-
Component/s: p4-plugin
-
Labels:None
-
Environment:Jenkins 1.462, Perforce plugin 1.3.13
-
Similar Issues:
Description
When a job is run, the Perforce plugin for Jenkins records a changelist number for the build instance. From that point forward, triggering additional builds via Perforce only happens when new changelists are submitted with numbers higher than the recorded changelist number. Great, except that the recorded changelist number may not be correct.
For example, if the most recent changelists look like this (from "p4 changelists -m 2"):
Change 24083 on 2012/05/23 by rmercer@rmercer-DcsMain pending 'The adapter layer now returns D'
Change 24082 on 2012/05/23 by reladmin@jenkins-aci-RILCinterion-QA-2 'Check in server build result fo'
and a build starts (either via the Build Now button, or because of 24082 being submitted), the Perforce plugin runs "p4 counter change" and records 24083 as the changelist number. Note that 24083 is a pending changelist.
Further polling will fail to detect that 24083 was submitted. No build will result. Oops, the latest "reserved" changelist number was recorded, rather than the latest "submitted" changelist number.
Often this problem is masked because new changelist numbers get generated upon a checkin, but not always. Perforce only renumbers a changelist upon checkin if there are intervening changelists.
Suggested solution: Rather than using "p4 counter change" to detect the current changelist number, please use "p4 changelists -m 1 -s submitted".
It already uses 'p4 changes -m 1 -s'. 'p4 counter change' is only used when looking for the actual latest change in the workspace. Here's an example from one of my own build logs:
'p4 counter change' returns 260111, but as you can see, it's using the last changeset that was submitted in the view for syncing.
In the cases where you've seen different behavior, were there any changes made at all? I suspect it may be falling back onto the value provided by the counter when there are no changes available in the view, which is of course incorrect behavior.