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

Perforce ditto mappings from clientspec do not work

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: p4-plugin
    • Labels:
    • Environment:
      Jenkins version 2.158
      P4-Plugin version 1.9.5
      Jenkins master server running on a centOS 7.3 VM. Jenkins slave launched through jenkins console. Slaves are also centos 7.3 VMs.
    • Similar Issues:

      Description

      Hi

       

      Please refer to Karl Wirth comment below for exact repro steps and error message. Error message pasted by me few lines below is incorrect.

       

      ----------------

      I use p4 plugin in my free style jenkins jobs to sync down source from our perforce server with a spec file located in depot. We use perforce [ditto mappings|https://www.perforce.com/manuals/p4guide/Content/P4Guide/configuration.workspace_view.one-to-many.html]  in our clientspec to map few files from one to many locations. While this works on our own machines with the p4 client, it fails on our jenkins job with warning like below.

       

      Warning: Client Spec line invalid, ignoring. (&//depot/mysource/a.xml //sc1234-ws/mysource/v1/a.xml)

       

      My clientspec view file has lines like 

      +/depot/mysource/a.xml //sc1234-ws/mysource/v1/a.xml
      &/depot/mysource/a.xml //sc1234-ws/mysource/v2/a.xml

      +/depot/mysource/b.xml //sc1234-ws/mysource/v1/b.xml
      &/depot/mysource/b.xml //sc1234-ws/mysource/v2/b.xml

       

      Are ditto mapping supported by this p4-plugin? And if yes, is this a bug? Please help.

       

      Thanks

        Attachments

          Activity

          Hide
          p4karl Karl Wirth added a comment -

          Hi sc1234 c - Thanks for highlighting this. I have never tried ditto mappings with P4Jenkins so will test and let you know what I find.

          Show
          p4karl Karl Wirth added a comment - Hi sc1234 c - Thanks for highlighting this. I have never tried ditto mappings with P4Jenkins so will test and let you know what I find.
          Hide
          p4karl Karl Wirth added a comment -

          Hi sc1234 c, Thanks again. I get a slightly different error but confirm that ditto mappings do not work so I will pass this to the developers. The workaround would be a build step that manually copies the files to the other locations in the workspace.

           

          Reproduction Steps:

          (1) Add '//depot/f1' to Perforce server.

          (2) Create a workspace with the following view and sync using P4 to prove it is valid:

          View:
          	//depot/f1 //ws_ditto/f1
          	&//depot/f1 //ws_ditto/f1_ditto
          
          

          (3) Create a Jenkins freestyle job with the following mapping:

          //depot/f1 //${P4_CLIENT}/f1
          &//depot/f1 //${P4_CLIENT}/f1_ditto
          

          (4) Build the job and the following error is seen:

          Console Output
          
          Started by user unknown or anonymous
          [EnvInject] - Loading node environment variables.
          Building on master in workspace /var/lib/jenkins/workspace/JENKINS-58109 Ditto Mappings Freestyle
          ... p4 client -o jenkins-master-JENKINS-58109_Ditto_Mappings_Freestyle-7 +
          ... p4 info +
          ... p4 info +
          ... p4 client -o jenkins-master-JENKINS-58109_Ditto_Mappings_Freestyle-7 +
          ... p4 client -i +
          
          P4: Unable to setup workspace: com.perforce.p4java.exception.RequestException: Error in client specification.
          Error detected at line 17.
          Null directory (//) not allowed in '&//depot/f1'.
          
          	at com.perforce.p4java.impl.mapbased.server.cmd.ResultMapParser.handleErrorStr(ResultMapParser.java:145)
          	at com.perforce.p4java.impl.mapbased.server.cmd.ResultMapParser.parseCommandResultMapIfIsInfoMessageAsString(ResultMapParser.java:96)
          	at com.perforce.p4java.impl.mapbased.server.cmd.ClientDelegator.updateClient(ClientDelegator.java:195)
          	at com.perforce.p4java.impl.mapbased.server.Server.updateClient(Server.java:1506)
          	at com.perforce.p4java.impl.mapbased.client.Client.update(Client.java:516)
          	at org.jenkinsci.plugins.p4.client.ClientHelper.updateClient(ClientHelper.java:180)
          	at org.jenkinsci.plugins.p4.client.ClientHelper.clientLogin(ClientHelper.java:159)
          	at org.jenkinsci.plugins.p4.client.ClientHelper.<init>(ClientHelper.java:101)
          	at org.jenkinsci.plugins.p4.tasks.CheckoutTask.initialise(CheckoutTask.java:61)
          	at org.jenkinsci.plugins.p4.PerforceScm.checkout(PerforceScm.java:522)
          	at hudson.scm.SCM.checkout(SCM.java:504)
          	at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
          	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
          	at hudson.model.Run.execute(Run.java:1815)
          	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          	at hudson.model.ResourceController.execute(ResourceController.java:97)
          	at hudson.model.Executor.run(Executor.java:429)
          
          ERROR: P4: Unable to initialise CheckoutTask: hudson.AbortException: Error in client specification.
          Error detected at line 17.
          Null directory (//) not allowed in '&//depot/f1'.
          
          Finished: FAILURE
          
          

          #

           

          Show
          p4karl Karl Wirth added a comment - Hi sc1234 c , Thanks again. I get a slightly different error but confirm that ditto mappings do not work so I will pass this to the developers. The workaround would be a build step that manually copies the files to the other locations in the workspace.   Reproduction Steps: (1) Add '//depot/f1' to Perforce server. (2) Create a workspace with the following view and sync using P4 to prove it is valid: View: //depot/f1 //ws_ditto/f1 & //depot/f1 //ws_ditto/f1_ditto (3) Create a Jenkins freestyle job with the following mapping: //depot/f1 //${P4_CLIENT}/f1 & //depot/f1 //${P4_CLIENT}/f1_ditto (4) Build the job and the following error is seen: Console Output Started by user unknown or anonymous [EnvInject] - Loading node environment variables. Building on master in workspace / var /lib/jenkins/workspace/JENKINS-58109 Ditto Mappings Freestyle ... p4 client -o jenkins-master-JENKINS-58109_Ditto_Mappings_Freestyle-7 + ... p4 info + ... p4 info + ... p4 client -o jenkins-master-JENKINS-58109_Ditto_Mappings_Freestyle-7 + ... p4 client -i + P4: Unable to setup workspace: com.perforce.p4java.exception.RequestException: Error in client specification. Error detected at line 17. Null directory ( //) not allowed in '&//depot/f1' . at com.perforce.p4java.impl.mapbased.server.cmd.ResultMapParser.handleErrorStr(ResultMapParser.java:145) at com.perforce.p4java.impl.mapbased.server.cmd.ResultMapParser.parseCommandResultMapIfIsInfoMessageAsString(ResultMapParser.java:96) at com.perforce.p4java.impl.mapbased.server.cmd.ClientDelegator.updateClient(ClientDelegator.java:195) at com.perforce.p4java.impl.mapbased.server.Server.updateClient(Server.java:1506) at com.perforce.p4java.impl.mapbased.client.Client.update(Client.java:516) at org.jenkinsci.plugins.p4.client.ClientHelper.updateClient(ClientHelper.java:180) at org.jenkinsci.plugins.p4.client.ClientHelper.clientLogin(ClientHelper.java:159) at org.jenkinsci.plugins.p4.client.ClientHelper.<init>(ClientHelper.java:101) at org.jenkinsci.plugins.p4.tasks.CheckoutTask.initialise(CheckoutTask.java:61) at org.jenkinsci.plugins.p4.PerforceScm.checkout(PerforceScm.java:522) at hudson.scm.SCM.checkout(SCM.java:504) at hudson.model.AbstractProject.checkout(AbstractProject.java:1208) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499) at hudson.model.Run.execute(Run.java:1815) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429) ERROR: P4: Unable to initialise CheckoutTask: hudson.AbortException: Error in client specification. Error detected at line 17. Null directory ( //) not allowed in '&//depot/f1' . Finished: FAILURE #  
          Hide
          jedavis Jason Davis added a comment -

          FWIW - I have a ditto path that I use in a script block in a declarative pipeline.  It looks like this:

          script {
              PerforceViewMap = """//Path1/... //jenkins-${JOB_BASE_NAME}-${NODE_NAME}/Path1/...
                  //DittoPath1/... //jenkins-${JOB_BASE_NAME}-${NODE_NAME}/Path1/DittoPathA/...
                  //Path2/... //jenkins-${JOB_BASE_NAME}-${NODE_NAME}/Path2/...
                  &//DittoPath1/... //jenkins-${JOB_BASE_NAME}-${NODE_NAME}/Path2/DittoPathB/...
                  //Path3/... //jenkins-${JOB_BASE_NAME}-${NODE_NAME}/Path3/..."""
                                  
              PerforceSource = perforce(browser: swarm('http://swarm.myserver.com'), 
              credential: 'creds', 
              populate: forceClean(have: true, parallel: [enable: false, minbytes: '1024', minfiles: '1', threads: '4'], 
                  pin: '', quiet: true), 
              workspace: manualSpec(charset: 'none', 
              name: 'jenkins-${JOB_BASE_NAME}-${NODE_NAME}', pinHost: false, 
                  spec: clientSpec(allwrite: true, backup: false, clobber: true, compress: false, 
                      line: 'LOCAL', locked: false, modtime: false, rmdir: true, serverID: '', streamName: '', type: 'WRITABLE', 
                  view: PerforceViewMap)))    
          }
                              
          checkout scm: PerforceSource
          
          Show
          jedavis Jason Davis added a comment - FWIW - I have a ditto path that I use in a script block in a declarative pipeline.  It looks like this: script { PerforceViewMap = """ //Path1/... //jenkins-${JOB_BASE_NAME}-${NODE_NAME}/Path1/... //DittoPath1/... //jenkins-${JOB_BASE_NAME}-${NODE_NAME}/Path1/DittoPathA/... //Path2/... //jenkins-${JOB_BASE_NAME}-${NODE_NAME}/Path2/... & //DittoPath1/... //jenkins-${JOB_BASE_NAME}-${NODE_NAME}/Path2/DittoPathB/... //Path3/... //jenkins-${JOB_BASE_NAME}-${NODE_NAME}/Path3/...""" PerforceSource = perforce(browser: swarm( 'http: //swarm.myserver.com' ), credential: 'creds' , populate: forceClean(have: true , parallel: [enable: false , minbytes: '1024' , minfiles: '1' , threads: '4' ], pin: '', quiet: true ), workspace: manualSpec(charset: 'none' , name: 'jenkins-${JOB_BASE_NAME}-${NODE_NAME}' , pinHost: false , spec: clientSpec(allwrite: true , backup: false , clobber: true , compress: false , line: 'LOCAL' , locked: false , modtime: false , rmdir: true , serverID: '', streamName: ' ', type: ' WRITABLE', view: PerforceViewMap))) } checkout scm: PerforceSource
          Hide
          sc1234 sc1234 c added a comment - - edited

          Thanks Karl Wirth and Jason Davis . I'll be applying the workaround for now. Thanks! 

           

          Karl Wirth You're right about the error. We have both old and new perforce plugins on our jenkins and some jobs are still using the old plugin, hence the different error.  I will update the description here to make that correction.

           

          In any case, a low-priority bug in p4-plugin still exists and will be good to fix. Thanks again for checking.

          Show
          sc1234 sc1234 c added a comment - - edited Thanks Karl Wirth and Jason Davis . I'll be applying the workaround for now. Thanks!    Karl Wirth You're right about the error. We have both old and new perforce plugins on our jenkins and some jobs are still using the old plugin, hence the different error.  I will update the description here to make that correction.   In any case, a low-priority bug in p4-plugin still exists and will be good to fix. Thanks again for checking.
          Hide
          p4karl Karl Wirth added a comment -

          Hi sc1234 c. Thanks and happy we can help. I will pass this onto the developers.

          Show
          p4karl Karl Wirth added a comment - Hi sc1234 c . Thanks and happy we can help. I will pass this onto the developers.
          Hide
          p4paul Paul Allen added a comment -

          Released in 1.10.1

          Show
          p4paul Paul Allen added a comment - Released in 1.10.1

            People

            • Assignee:
              p4paul Paul Allen
              Reporter:
              sc1234 sc1234 c
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: