-
Bug
-
Resolution: Fixed
-
Blocker
Karls Summary:
Polled builds (pipeline) should sync to "@now" when polling occurred not "@now" when sync occurs.
Usage case - On a busy system a long running job will pickup components of different ages.
Example -
- Poll finds latest change 123
- Build is queued
- Change 124 added to path1.
- Build starts
- Path1 synced at 124
- Change 125 and 126 submitted to path2.
- Path1 sync completes, path2 sync starts at 126
The desired behavior is path1 and path2 should be synced at 123 (if that is not possible in the Jenkins infrastructure path 1 and path2 should be synced at 124).
Original Description:
HI we have setup a parallel pipeline and are using SyncOnlyImpl's pin to ensure all parallel stages will build on the same changelist.
Our first implementation worked as expected. pin value was empty at first, causing it to sync to head then we extracted this value and propagated to other stages through a field.
However other requirements required us to have that change be accessible in other parts of the build pipeline so we start the pipeline with a simple p4 command to get the head CL which is then propagated through the rest of the pipeline normally rather than through a field.
Sync behavior is as expected where all stages sync to desired CL BUT polling is now limited by this pin value and will always check for changes using the pinned value as an upper limit.
Net effect if this is polling still takes place but never detect any changes effectively nullifying poll behavior beyond the first run.
I would expect a way to sync to a specific CL that has no side effect in other parts of the system. Either the pin behavior is broken, or an extra parameter is required beyond pin to separate the two intent : the CL at which we wish to "pin" this job, and the CL at which we wish to sync in the populate implementation.
- relates to
-
JENKINS-65246 P4 Polling does not work correctly if changelist is specified during sync
-
- Closed
-
Our pipeline resembles this pseudo seen below. The code is over-simplified and will likely not run as-is but it does give the essential of what is happening.
Basically here we need to ensure that all stages in the parallel to build at the same CL. By default each will sync to head at the time they start, since each gets assigned to a different agent it's quite possible one or more is put in the queue to wait for available resources. During that time it's very likely that new commits occur thus having them all sync to head creates a "staggered" build across multiple changes which is undesirable.
We used to do it in the way you suggests where one is not pinned, we struggled a bit to get the information across other stage but eventually made it work. however getting that changelist ID to propagate to other steps prooved to be challenging and it became much simpler to just fetch the change eagerly and pass it along the entire pipeline.
Now we have averything working just dandy and all other steps that need access to the changelist can do so naturally... except polling no longer work because of this side effect. And since there are no obvious alternative ways to sync through the plugin that would not generate this side effect we are basically stuck. Temporary solution was to change the polling with a cron and force trigger the job each 30 mins or so.
We experimented with perforce triggers and ran in another issue. Since the changelist is not (least wasnot at the time we tried) attached to the job being triggered we ran in situations where each commit woudl trigger a job but build system restrictions caused long queues. To make things worst when a job started it would pick head CL thus many jobs ended running at the same CL because of this which was very wasteful use of resources.
Last thing we had not tried yet was to simply do without the populate and run the p4 sync directly with a p4.run.
the steps sync contains this code which does the actual sync
Edit:
added skipDefaultCheckout() in option block at start of pipeline
reformat pipeline code