-
Bug
-
Resolution: Fixed
-
Minor
-
Powered by SuggestiMate
I am trying to use the standalone p4 unshelve in the pipeline code.
This works fine, except that it doesn't update the SCM changes / getAffectedFiles() ? at all.
This is done correctly in the normal sync step in a job when a shelved cl is passed in.
If this works then i can implement JENKINS-32761 using pipeline code.
At the moment this bug means i cannot move to using pipelines in some cases.
If i can get a hint on where to make the changes then i could see if i can help
[JENKINS-38781] p4 unshelve not updating changes (pipeline)
what is the progress on this ?
Been 4 months since the last update.
Is is critical for a SCM plugin to display the changes that a build are using.
I am willing to help implement this fix, i just need to know where to add it
Hi mornejoubert - I've just been going through the jobs and saw this was still open. Is this still a problem?
Sorry for the delayed reply, i had to get a new Jira username
Yes, this is still an issue.
Pretty easy to test
Hi mornejoubert - I'd like to review this one with the developers so I did the following test.
P4_CHANGELIST is reported but it matches the latest changelist the workspace was synced to. For example unshelving changelist 2254:
pipeline { agent { label 'master' } stages { stage("Repro") { steps { script { def p4env = p4unshelve credential: 'JenkinsMaster', ignoreEmpty: false, resolve: 'at', shelf: '2254', tidy: false, workspace: manualSpec(charset: 'none', cleanup: false, name: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}', pinHost: false, spec: clientSpec(allwrite: false, backup: true, changeView: '', clobber: true, compress: false, line: 'LOCAL', locked: false, modtime: false, rmdir: false, serverID: '', streamName: '', type: 'WRITABLE', view: '//depot/JENKINS-38781-UnsyncChangelist/... //jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}/... ')) echo "P4_CHANGELIST is:" echo env.P4_CHANGELIST echo sh(script: 'env|sort', returnStdout: true) } } } } }
In the output:
...cut... P4 Task: unshelve review: 2254 ... p4 unshelve -f -s2254 -cdefault +//depot/JENKINS-38781-UnsyncChangelist/f1 ... duration: (2ms) P4 Task: resolve: -at ... p4 resolve -at /var/lib/jenkins/workspace/JENKINS-38781-ChangelistOnUnshelve/... +... duration: (1ms) [Pipeline] echo P4_CHANGELIST is: [Pipeline] echo 2268 ...cut...
What do you want P4_CHANGELIST to be set to? Note the changes are also seen in Jenkins:
i currently set the P4_CHANGELIST to the CL the code was synced to , and totally ignore ENV for the shelved CLs since you can unshelve 10 different change lists
What i do in my pipeline wrappers is to have
P4_CHANGELIST = cl/label
P4_UNSHELVESET= a,b,c
Hi mornejoubert - Sorry I'm missing the point here. I've read the job you mention but can you describe for me exactly what you want to do and what is not working.
In the screenshot you can see my pipeline output.
In this code i synced CL 614442 on 2 streams and then unshelved 614492
1) The CL 614442 appears both (for each stream) , the code doesn't create a single set of unique CLs
2) I can see no shelve CL comments
[2019-12-11T16:33:23.125Z] P4 Task: unshelve review: 614492 [2019-12-11T16:33:23.127Z] (p4):cmd:... p4 unshelve -f -s614492 -cdefault [2019-12-11T16:33:23.127Z] p4 unshelve -f -s614492 -cdefault
The pipeline code shows the unshelve but nothing in the summary
The pipeline groovy looks like
p4unshelve credential: p4_credential, resolve: 'at', shelf: ubxShelve, tidy: false, workspace: [$class: 'StreamWorkspaceImpl', charset: 'none', format: p4Workspace, pinHost: false, streamName: perforceStream]
The sync steps (that does provide the changes summary), looks like
checkout poll: false, scm: perforce( credential: credential_id, populate: autoClean(delete: true, modtime: true, parallel: [enable: false, minbytes: '1024', minfiles: '1', threads: '4'], pin: perforceLabel, quiet: false, replace: true, tidy: false), workspace:ws )
in your testing, please do a sync step and then an unshelve step and check both are in the jenkins changes summary page. thanks
Hi mornejoubert - Happy New Year and thanks for all the detail. I was easily able to reproduce this so will pass it back to the devs.
Reproduction Steps:
(1) Create the depot structure:
//depot/JENKINS-38781-UnsyncChangelist/JenkinsfileHome/Jenkinsfile
//depot/JENKINS-38781-UnsyncChangelist/sync/s1
//depot/JENKINS-38781-UnsyncChangelist/unshelve/u1
(2) In the Jenkinsfile put the following code:
pipeline { agent { label 'master' } stages { stage("Repro") { steps { script { p4sync charset: 'none', credential: 'JenkinsMaster', populate: autoClean(delete: true, modtime: false, parallel: [enable: false, minbytes: '1024', minfiles: '1', threads: '4'], pin: '', quiet: false, replace: true, tidy: false), source: depotSource('//depot/JENKINS-38781-UnsyncChangelist/sync/...') def p4env = p4unshelve credential: 'JenkinsMaster', ignoreEmpty: false, resolve: 'at', shelf: '2254', tidy: false, workspace: manualSpec(charset: 'none', cleanup: false, name: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}-unshelve', pinHost: false, spec: clientSpec(allwrite: false, backup: true, changeView: '', clobber: true, compress: false, line: 'LOCAL', locked: false, modtime: false, rmdir: false, serverID: '', streamName: '', type: 'WRITABLE', view: '//depot/JENKINS-38781-UnsyncChangelist/unshelve/... //jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}-unshelve/unshelve/... ')) } } } } }
Note that there is a sync step followed by an unshelve to a different directory.
(3) Run the job using 'Build Now'.
The unshelve step should have unshelved '2254' but it is not reported:
We would like to see unshelved changelist reported.
I am experimenting the same problem... My CL unshelve through the plugin, after a checkout() using p4 plugin also results in the changeset being empty or missing the CL that got unshelve.
Only using checkout with changelog: true then I get p4 plugin to populate changeset but only with the sync's CL which is of no interest in the case of an unshelve situation.
Releated to
JENKINS-37584