Feature request: Implement poll per change on multibranch pipeline jobs.
With multibranch poll per change doesnt poll every change but does build only the next change that needs to be built.For example:
(1) Add CL 626, 627 and 628.
(2) The multi branch top level poll is configured for 1 min (see below). When it triggers it detects that 625 to 628 exist.
(3) The job checks SyncID and correctly finds '625' as the previous last sync.
Found last change 625 on syncID jenkins-NODE_NAME-MultiBranch_PollPerChange-main-EXECUTOR_NUMBER
(4) Due to filtering only the next changelist is synced:
P4 Task: syncing files at change: 626
(5) Jenkins records the last successful build for this branch correctly:
branches/main/lastSuccessful/build.xml: <change>626</change>
(6) But (and I'm guessing this is the cause) sets '628' in the following file:
branches/main/scm-revision-hash.xml
The next time a poll runs it will only fire if a new changelist has been created but will build changelist '627' only (so will now be building 2 changelists behind current).
My Jenkinsfile:
1 pipeline { 2 agent { label 'master' } 3 options { skipDefaultCheckout() } 4 stages { 5 stage("Repro") { 6 steps { 7 script { 8 checkout perforce(credential: 'MasterServer', filter: [incremental(true)], populate: autoClean(delete: true, modtime: false, parallel: [enable: false, minbytes: '1024', minfiles: '1', threads: '4'], pin: '', quiet: true, replace: true, tidy: false), workspace: manualSpec(charset: 'none', name: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}', pinHost: false, spec: clientSpec(allwrite: false, backup: false, clobber: true, compress: false, line: 'LOCAL', locked: false, modtime: false, rmdir: false, serverID: '', streamName: '', type: 'WRITABLE', view: '//depot/multibranch_poll_per_change/main/... //jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}/...'))) 9 sh "pwd" 10 sh "ls -l" 11 sh "cat -n *" 12 sh "echo ${env.BRANCH_NAME}" 13 } 14 } 15 } 16 } 17 }
- is related to
-
JENKINS-51525 Pipeline: Poll per change syncs to head when using 'checkout' or 'p4 sync' step.
-
- Closed
-
- relates to
-
JENKINS-47427 Poll per change with pipeline jobs
-
- Closed
-
-
JENKINS-51525 Pipeline: Poll per change syncs to head when using 'checkout' or 'p4 sync' step.
-
- Closed
-
It also occurs on Freestyle project.
As per the attached screen shot, "Change 12264" submit is not run after "Change 12263" submit has been run. "Change 12264" submit will be run after "Change 12265" is submitted.
$ p4 edit a.txt
//test/a.txt#23 - opened for edit
$ p4 submit -d "test"
Submitting change 12263.
Locking 1 files ...
edit //test/a.txt#24
Change 12263 submitted.
$ p4 edit a.txt
//test/a.txt#24 - opened for edit
$ p4 submit -d "test"
Submitting change 12264.
Locking 1 files ...
edit //test/a.txt#25
Change 12264 submitted.
$ p4 edit a.txt
//test/a.txt#25 - opened for edit
$ p4 submit -d "test"
Submitting change 12265.
Locking 1 files ...
edit //test/a.txt#26
Change 12265 submitted.
When not using "Poll per change", concurrent submitted changelists are run together in one Jenkins build.
Hence, it would be good if one Jenkins build is run automatically per submit without remaining submitted changelists like "Poll per change".
Hope it makes sense.