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)

          Morne Joubert added a comment -

          What i do in my pipeline wrappers is to have

          P4_CHANGELIST = cl/label

          P4_UNSHELVESET= a,b,c

           

          Morne Joubert added a comment - What i do in my pipeline wrappers is to have P4_CHANGELIST = cl/label P4_UNSHELVESET= a,b,c  

          Karl Wirth added a comment -

          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.

          Karl Wirth added a comment - 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.

          Morne Joubert added a comment -

          the ticket was created 3 years ago  let me check

           

          Morne Joubert added a comment - the ticket was created 3 years ago  let me check  

          Morne Joubert added a comment -

          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

          Morne Joubert added a comment - 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

          Morne Joubert added a comment -
          [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 )
          

          Morne Joubert added a comment - [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 )

          Morne Joubert added a comment -

          Am on jenkins 2.176.4 with p4-plugin 1.10.6

          Morne Joubert added a comment - Am on jenkins 2.176.4 with p4-plugin 1.10.6

          Morne Joubert added a comment -

          in your testing, please do a sync step and then an unshelve step and check both are in the jenkins changes summary page. thanks

          Morne Joubert added a comment - in your testing, please do a sync step and then an unshelve step and check both are in the jenkins changes summary page. thanks

          Karl Wirth added a comment -

          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.

           

           

          Karl Wirth added a comment - 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.

           

          Yannick Koehler added a comment - 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.  

          Paul Allen added a comment -

          Resolved in 1.13.0

          Paul Allen added a comment - Resolved in 1.13.0

            Unassigned Unassigned
            mornejoubert Morne Joubert
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: