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

P4Plugin undo unshelve - Improve auto generated doc (explain tidy)

      UPDATED: Improve the auto generated doc to explain what 'tidy' does:

      ORIGINAL QUESTION:

      So I got a Pipeline where I do an unshelve operation with the p4plugin.

      The command looks like this:

       

      p4unshelve(
                           credential: 'CI_Creds',
                           shelf: "${unshelve{color:#569cd6}}",
                           workspace: staticSpec(charset: 'none', pinHost: false, name: 'ci_workspace'))

       
      This works just as I would expect it to work.
      But I can't seem to figure out a way to have an equivalent command using p4plugin for p4.exe revert -c default //...
       
      I just want to be able to undo the unshelve command when the pipeline ends.
      I tried using a regular batch command, I guess I could get that to work if I set up the environment correctly but this would also mean that the p4credentials would have to be passed to that batch command which I don't want.
       
      Is there a solution for this?
       
      Thanks in advance.

          [JENKINS-72381] P4Plugin undo unshelve - Improve auto generated doc (explain tidy)

          Karl Wirth added a comment -

          Hi _dentist - You should be able to use the "Clean up Review actions:" mentioned here:

               https://www.perforce.com/manuals/jenkins/Content/P4Jenkins/build-step-unshelve-snippet-generator.html?Highlight=revert

          For example:

          p4unshelve credential: 'TESTING', ignoreEmpty: false, resolve: 'none', shelf: '1234', tidy: true,   ### CLEAN UP
              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/project1/main/... //${P4_CLIENT}/...')) 

          Please give that a try.

          Karl Wirth added a comment - Hi _dentist - You should be able to use the "Clean up Review actions:" mentioned here:       https://www.perforce.com/manuals/jenkins/Content/P4Jenkins/build-step-unshelve-snippet-generator.html?Highlight=revert For example: p4unshelve credential: 'TESTING' , ignoreEmpty: false , resolve: 'none' , shelf: '1234' , tidy: true , ### CLEAN UP     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/project1/main/... //${P4_CLIENT}/...' )) Please give that a try.

          Kürsat Kukul added a comment - - edited

          Worked perfectly fine.

          I am just wondering why you guys are not more specific on this page: https://www.jenkins.io/doc/pipeline/steps/p4/

          I mean tidy could mean a lot of things.

          Anyway here is the undo unshelve command I used for anyone else wondering:
           

          p4unshelve(                   credential: 'CI_Creds',                   resolve: 'none',                   shelf: "${unshelve}",                   tidy: true,                   workspace: staticSpec(charset: 'none', pinHost: false, name: 'ci_workspace'))

           
           

           

          Kürsat Kukul added a comment - - edited Worked perfectly fine. I am just wondering why you guys are not more specific on this page: https://www.jenkins.io/doc/pipeline/steps/p4/ I mean tidy could mean a lot of things. Anyway here is the undo unshelve command I used for anyone else wondering:   p4unshelve(                   credential: 'CI_Creds' ,                   resolve: 'none' ,                   shelf: "${unshelve}" ,                   tidy: true ,                   workspace: staticSpec(charset: 'none' , pinHost: false , name: 'ci_workspace' ))      

          Karl Wirth added a comment -

          Hi _dentist - Great that it worked.

          I beleive that doc is auto generated from our code. I will change this to an enhancement request asking for the section in the code that is picked up to be clarified.

          Regards,

          Karl

          Karl Wirth added a comment - Hi _dentist - Great that it worked. I beleive that doc is auto generated from our code. I will change this to an enhancement request asking for the section in the code that is picked up to be clarified. Regards, Karl

          Karl Wirth added a comment -

          Reopening and changing to an enhancement request against the auto generated doc.

          Karl Wirth added a comment - Reopening and changing to an enhancement request against the auto generated doc.

          Kürsat Kukul added a comment - - edited

          Hi p4karl ,

          I just noticed that only the changelist which was created by the unshelve command is deleted but the actual files have exactly the state of the unshelved files.

          Is this a bug? It seems so.

          The actual operation done could be p4 revert -k because the workspace files just stay as they are. https://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_revert.html

          Kürsat Kukul added a comment - - edited Hi p4karl , I just noticed that only the changelist which was created by the unshelve command is deleted but the actual files have exactly the state of the unshelved files. Is this a bug? It seems so. The actual operation done could be p4 revert -k because the workspace files just stay as they are. https://www.perforce.com/manuals/cmdref/Content/CmdRef/p4_revert.html

            Unassigned Unassigned
            _dentist Kürsat Kukul
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: