Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-41622

Perforce unshelve command override local file without revision verification.

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • p4-plugin
    • Jenkins ver: 2.32.1
      P4 Plugin: 1.4.13

      We use Jenkins for pre-commit verification.
      To do this - developer shelve changes under CL. Jenkins job Sync to HEAD, unshelve changes, build and run verification.
      If someone submit changes in shelved file and developer don't update and re-shelve this file before verification - submitted changes will be overridden by shelved file without any errors or merge.

      Test case:

      • create file test.txt with any content
      • submit this file to Perforce under revision 1
      • do any changes in this file and shelve it under CL
      • change this file and submit under revision 2
      • run job
        • load file from SCM(configured in "Source Code Management>Perforce Software")
        • unshelve CL in build steps
      • check that second revision test.txt overridden by file from shelved CL.

      Resolve Options doesn't change unshelve build step behavior.

          [JENKINS-41622] Perforce unshelve command override local file without revision verification.

          Rob Petti added a comment -

          Wrong plugin. I think you are looking for the p4-plugin. perforce-plugin doesn't have shelving functionality.

          Rob Petti added a comment - Wrong plugin. I think you are looking for the p4-plugin. perforce-plugin doesn't have shelving functionality.

          Paul Allen added a comment -

          I think there needs to be an extra 'sync' to schedule the file for resolve after the unshelve.  It is unusual to have a shelved revision that is older than the synced revision in the Workspace.

          e.g. a typical workflow:

          Populate Step:
             p4 sync 
          Unshelve Step:
             p4 unshelve
             p4 sync (to schedule resolve on older revisions)
             p4 resolve

           

          Paul Allen added a comment - I think there needs to be an extra 'sync' to schedule the file for resolve after the unshelve.  It is unusual to have a shelved revision that is older than the synced revision in the Workspace. e.g. a typical workflow: Populate Step: p4 sync Unshelve Step: p4 unshelve p4 sync (to schedule resolve on older revisions) p4 resolve  

          Paul Allen added a comment -

          Possible fix in UnshelveTask:

          p4.unshelveFiles(shelf);
          
          Populate populate = new AutoCleanImpl();
          p4.syncFiles(new P4ChangeRef(shelf), populate);
          
          p4.resolveFiles(resolve);
          
          if(tidy) {
             p4.revertAllFiles(true);
          }

          Paul Allen added a comment - Possible fix in UnshelveTask: p4.unshelveFiles(shelf); Populate populate = new AutoCleanImpl(); p4.syncFiles( new P4ChangeRef(shelf), populate); p4.resolveFiles(resolve); if (tidy) { p4.revertAllFiles( true ); }

          alex_kalach - is this still an issue for you?

          W Basu Perforce added a comment - alex_kalach - is this still an issue for you?

            p4paul Paul Allen
            alex_kalach Alexander Kalach
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: