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

Unshelve doesn't update changelist and prints error when used with manual workspace specification

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • p4-plugin
    • None
    • P4 Plugin Version1.13.3

      Example pipeline:

      stage('Test') {
          node() {
              checkout perforce(credential: 'jenkinsp4', 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: 'utf8', 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: '', view: '//depot/main/... //jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}/...')))
              p4unshelve credential: 'jenkinsp4', ignoreEmpty: false, resolve: 'none', shelf: '3731', tidy: false, workspace: manualSpec(charset: 'utf8', cleanup: false, name: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}', pinHost: false, spec: clientSpec(allwrite: false, backup: false, changeView: '', clobber: true, compress: false, line: 'LOCAL', locked: false, modtime: false, rmdir: false, serverID: '', view: '//depot/main/... //jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}/...'))
          }
      }

      Although the CL is unshelved, it's not visible on the build changes page, and the following error is printed on the console:

       

      Error in client specification.
      Mapping '//jenkins-NODE_NAME-JOB_NAME-EXECUTOR_NUMBER/...' is not under '//jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}/...'.
      (p4):stop:10
      P4: Unable to setup workspace: com.perforce.p4java.exception.RequestException: Error in client specification.
      Mapping '//jenkins-NODE_NAME-JOB_NAME-EXECUTOR_NUMBER/...' is not under '//jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}/...'.
              at com.perforce.p4java.impl.mapbased.server.cmd.ResultMapParser.handleErrorStr(ResultMapParser.java:146)
              at com.perforce.p4java.impl.mapbased.server.cmd.ResultMapParser.parseCommandResultMapIfIsInfoMessageAsString(ResultMapParser.java:98)
              at com.perforce.p4java.impl.mapbased.server.cmd.ClientDelegator.updateClient(ClientDelegator.java:212)
              at com.perforce.p4java.impl.mapbased.server.Server.updateClient(Server.java:1728)
              at com.perforce.p4java.impl.mapbased.client.Client.update(Client.java:528)
              at org.jenkinsci.plugins.p4.client.ClientHelper.updateClient(ClientHelper.java:191)
              at org.jenkinsci.plugins.p4.client.ClientHelper.clientLogin(ClientHelper.java:170)
              at org.jenkinsci.plugins.p4.client.ClientHelper.<init>(ClientHelper.java:104)
              at org.jenkinsci.plugins.p4.unshelve.UnshelveBuilder.updateChangeLog(UnshelveBuilder.java:141)
              at org.jenkinsci.plugins.p4.unshelve.UnshelveBuilder.unshelve(UnshelveBuilder.java:134)
              at org.jenkinsci.plugins.p4.unshelve.UnshelveBuilderStep.perform(UnshelveBuilderStep.java:42)
              at org.jenkinsci.plugins.p4.workflow.P4UnshelveStep$P4UnshelveStepExecution.run(P4UnshelveStep.java:133)
              at org.jenkinsci.plugins.p4.workflow.P4UnshelveStep$P4UnshelveStepExecution.run(P4UnshelveStep.java:119)
              at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at java.lang.Thread.run(Thread.java:750)
      

       

          [JENKINS-70584] Unshelve doesn't update changelist and prints error when used with manual workspace specification

          Eivind added a comment -

          I think I am running into the same issue here. After much testing, it appears on my end that the string interpolation with p4unshelve command is busted. It works when you call it using checkout (changelog: false, poll: false, scm: perforce( ... workspace: manualSpec( name: "Your P4 Client here", view = '''//Path/A/... //${P4_CLIENT}/A/...''')). When you use checkout the workspace variable seems to properly resolve the variables, when you use p4unshelve this seems to not be working.

          Eivind added a comment - I think I am running into the same issue here. After much testing, it appears on my end that the string interpolation with p4unshelve command is busted. It works when you call it using checkout (changelog: false, poll: false, scm: perforce( ... workspace: manualSpec( name: "Your P4 Client here", view = '''//Path/A/... //${P4_CLIENT}/A/...''')). When you use checkout the workspace variable seems to properly resolve the variables, when you use p4unshelve this seems to not be working.

          Eivind added a comment -

           

          Also noting that Helix recommends the use of single ''' instead of """ to prevent early variable expansion. This doesn't seem to be working.

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

          Eivind added a comment -   Also noting that Helix recommends the use of single ''' instead of """ to prevent early variable expansion. This doesn't seem to be working. https://www.perforce.com/manuals/jenkins/Content/P4Jenkins/build-step-unshelve-snippet-generator.html?Highlight=p4%20unshelve%20jenkins

            Unassigned Unassigned
            abannerth Akos
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: