-
Bug
-
Resolution: Fixed
-
Major
-
Jenkins 2.89.3
P4-Plugin 1.8.10
When using Poll per change the system will correctly run individual builds for each new changelist but if using 'p4sync' or 'checkout' steps are used they will sync to #HEAD instead of the changelist to be built.
For example if the Jenkinsfile relies on the implicit sync that happens automatically the behavior is:
Setup job with a 30 second sleep at start Submit CL 1, 2 ,3, 4 Build 1 runs that syncs up to changelist 1 and reports that only CL 1 has built. Build 2 runs that syncs up to changelist 2 and reports that only CL 2 has built. Build 3 runs that syncs up to changelist 3 and reports that only CL 3 has built. Build 4 runs that syncs up to changelist 4 and reports that only CL 4 has built.
If instead the implicit sync is switched off and an explicit 'p4sync' or checkout' is used in the Jenkinsfile the behavior is:
Setup job with a 30 second sleep at start Submit CL 1, 2 ,3, 4 Build 1 runs that syncs up to changelist 4 but reports that only CL 1 has built. Build 2 runs that syncs up to changelist 4 but reports that only CL 2 has built. Build 3 runs that syncs up to changelist 4 but reports that only CL 3 has built. Build 4 runs that syncs up to changelist 4 but reports that only CL 4 has built.
Reproduction Step:
(1) Create a pipeline job with Jenkinsfile in SCM and polling build filter of 'Polling Per Change'.
(2) Create a dummy Jenkinsfile with a sleep and submit to Perforce. For example:
pipeline { //agent any agent{label 'MySlave'} //options { skipDefaultCheckout() } stages { stage("PollPerChange") { steps { script { echo "In script." echo "Sleeping..." sleep 30 //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/pollperchange/... //jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}/...'))) sh 'ls' } } } } }
(3) Create 3 changelists in relevant path then run 'poll now' on job (customised to your environment) as it is.
(4) Uncomment 3 lines in Jenkinsfile and submit to Perforce.
(5) Create 3 changelists in relevant path then run 'poll now' on job.
- is related to
-
JENKINS-52066 Poll per change with multibranch pipeline jobs
-
- Closed
-
- relates to
-
JENKINS-47427 Poll per change with pipeline jobs
-
- Closed
-
-
JENKINS-52066 Poll per change with multibranch pipeline jobs
-
- Closed
-
The Jenkinsfile in my test setup (I also set Poll per Change on the Pipeline Script from SCM):
//deep/subX/main is a stream in a different location to the Jenkinsfile defined in the Pipeline Script from SCM (also a stream at //deep/projA/main). Changes in //deep/subX/main seem to sync as expected with Poll per Change.
Changes to //deep/projA/main are not seen by polling as Lightweight checkout was selected (client is thrown away and p4 print is used so no have list).