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

Jenkins2, P4 Plugin: Error must create client <name>' to access local files

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • p4-plugin
    • OS: Ubuntu 18.04
      JDK 1.8.0_181
      P4 Plugin v
      Jenkins v2.222.1
      P4 Plugin v1.10.12
      Jenkins master in container (image: jenkins/jenkins:2.222.1)
      Jenkin slaves in container (image: jenkins/jnlp-slave:3.27-1)

      Getting error message "must create client 'ip-10-21-2-84' to access local files".

      It appears when the job is executed on the jenkins slave the P4 client is not being created.  Does the p4 plugin create the workspace and manages the workspace view.  Or does the p4 plugin require an additional setup that I might be missing.

      • Job Configuration:    Reference attached job config.xml
      • Build log attached.

      Note that I also tested the job on a jenkins slave that was not in a container.  Got the same error.   When I ran 'p4 client' and set-up the root and mapping, the jenkins job worked.

       

       

        1. image-2020-04-23-08-59-08-936.png
          image-2020-04-23-08-59-08-936.png
          6 kB
        2. image-2020-04-23-08-57-39-950.png
          image-2020-04-23-08-57-39-950.png
          10 kB
        3. image-2020-04-23-08-55-54-786.png
          image-2020-04-23-08-55-54-786.png
          8 kB
        4. jenkins2-job-console.log
          5 kB
        5. jenkins2-job-config.xml
          3 kB
        6. jenkins2-job-console.log
          5 kB
        7. jenkins1-job-console.log
          2 kB
        8. jenkins1-job-config.xml
          6 kB
        9. image-2020-04-20-13-40-22-145.png
          image-2020-04-20-13-40-22-145.png
          12 kB
        10. jenkins-1.651.2-job-config.xml
          7 kB
        11. jenkins-1.651.2-job-config.xml
          7 kB
        12. build.log
          13 kB
        13. job-config.xml
          5 kB

          [JENKINS-61943] Jenkins2, P4 Plugin: Error must create client <name>' to access local files

          David Rodriguez created issue -

          Karl Wirth added a comment -

          Hi drodspike

          This looks likes it a problem in Maven (possibly P4Maven if you are using it) not P4Jenkins.

          We see P4Jenkins succesfully doing it's sync against a the client 'jenkins-jenkins-slave-test1-admin-ui-4.2-0' here on a node called 'ip-10-21-2-84':

          P4 Task: syncing files at change: 290033 (p4):cmd:... p4 sync -q /data/jenkins_home/workspace/admin-ui-4.2/...@290033 p4 sync -q /data/jenkins_home/workspace/admin-ui-4.2/...@290033

          Then later on when the Maven command runs:

          [admin-ui-4.2] $ /data/jenkins_home/tools/apache-maven-3.6.3/bin/mvn -s /data/jenkins_home/maven_repository/settings.xml -Pmycomci clean deploy -B -U -Dit.skip=true
          

          we see the error:

          +LCAAAAAAAAP9b85aBtbiIQSmjNKU4P0+vJLE4u1gvPjexLDVPzxdEuhYV5Rf55ZekOlc7RKnPKH7IxMBQUcQgBdWQnJ9XnJ+TqucMoUEKGSCAEaSwAACsNFCqYAAAAA==[ERROR] Failed to execute goal com.mycom:mycom-build-info-plugin:1.0.14:create (vernum) on project admin.ui: Unable to fetch p4 head version for path/data/jenkins_home/workspace/admin-ui-4.2: P4 process `/bin/sh -c p4 -d /data/jenkins_home/workspace/admin-ui-4.2 changes -m1 ...` returned error code;rc;1;Error message;... - must create client 'ip-10-21-2-84' to access local files. -> [Help 1] ha:////4Lo+a7u/lzaTkq1HGH3U8JSMfSgah36g77z15FvpSvDYAAAAYB

          When P4CLIENT is not set in the environment we default to using the hostname for the client (in this case 'ip-10-21-2-84'.

          Looking at the maven docs (https://www.perforce.com/manuals/p4maven/index.html) you may need to explicitly pass the client name onto Maven. Possibly:

          mvn -Dmaven.scm.perforce.clientspec.name=$P4_CLIENT .....
          

           

           

           

           

           

           

          Karl Wirth added a comment - Hi drodspike This looks likes it a problem in Maven (possibly P4Maven if you are using it) not P4Jenkins. We see P4Jenkins succesfully doing it's sync against a the client 'jenkins-jenkins-slave-test1-admin-ui-4.2-0' here on a node called 'ip-10-21-2-84': P4 Task: syncing files at change: 290033 (p4):cmd:... p4 sync -q /data/jenkins_home/workspace/admin-ui-4.2/...@290033 p4 sync -q /data/jenkins_home/workspace/admin-ui-4.2/...@290033 Then later on when the Maven command runs: [admin-ui-4.2] $ /data/jenkins_home/tools/apache-maven-3.6.3/bin/mvn -s /data/jenkins_home/maven_repository/settings.xml -Pmycomci clean deploy -B -U -Dit.skip= true we see the error: +LCAAAAAAAAP9b85aBtbiIQSmjNKU4P0+vJLE4u1gvPjexLDVPzxdEuhYV5Rf55ZekOlc7RKnPKH7IxMBQUcQgBdWQnJ9XnJ+TqucMoUEKGSCAEaSwAACsNFCqYAAAAA==[ERROR] Failed to execute goal com.mycom:mycom-build-info-plugin:1.0.14:create (vernum) on project admin.ui: Unable to fetch p4 head version for path/data/jenkins_home/workspace/admin-ui-4.2: P4 process `/bin/sh -c p4 -d /data/jenkins_home/workspace/admin-ui-4.2 changes -m1 ...` returned error code;rc;1;Error message;... - must create client 'ip-10-21-2-84' to access local files. -> [Help 1] ha: ////4Lo+a7u/lzaTkq1HGH3U8JSMfSgah36g77z15FvpSvDYAAAAYB When P4CLIENT is not set in the environment we default to using the hostname for the client (in this case 'ip-10-21-2-84'. Looking at the maven docs ( https://www.perforce.com/manuals/p4maven/index.html ) you may need to explicitly pass the client name onto Maven. Possibly: mvn -Dmaven.scm.perforce.clientspec.name=$P4_CLIENT .....            
          Karl Wirth made changes -
          Assignee New: Karl Wirth [ p4karl ]
          Karl Wirth made changes -
          Labels Original: jenkins plugin New: P4_SUPPORT jenkins plugin
          David Rodriguez made changes -
          Attachment New: jenkins-1.651.2-job-config.xml [ 50976 ]
          David Rodriguez made changes -
          Attachment New: jenkins-1.651.2-job-config.xml [ 50977 ]

          David Rodriguez added a comment - - edited

          Hi Karl, I really appreciate the quick response to my issue. 

          What I'm attempting to do is test upgrading our Jenkins1 (v1.651.2) environment to Jenkins2 (v2.222.1) before upgrading our production jenkin server and slaves.  I was  hoping that the upgrade was simply allowing the new p4@1.10.12 plugin manage the necessary scm class changes to create the p4 client to run the job without having to make additional changes.  Note that we are NOT using P4Maven for our Perforce jobs.

          Below is a snippet from the  jenkins1 job config.xml  versus the jenkins2 job config.xml  after the upgrade. Note that the jenkins1 job.xml specifies the p4client and the jenkins2 job.xml does NOT .  Is there a reason for that?  I also attached the jenkins1 job config.xml and build log before the upgrade for your review.

          Snippet from the  jenkins1 job config.xml  'scm class' for plugin="perforce@1.3.35" BEFORE the upgrade.
          The scm class specifies the tag <p4Client>ci-admin-ui-4.2</p4Client> .

            <scm class="hudson.plugins.perforce.PerforceSCM" plugin="perforce@1.3.35">
              <configVersion>2</configVersion>
              <p4User>compil</p4User>
              <p4Passwd>0f0kqlwaRgSE9uduYTPfa3AlrK8xqw==</p4Passwd>
              <p4Port>p4proxy:1667</p4Port>
          --> <p4Client>ci-admin-ui-4.2</p4Client>
              <projectPath>//depot/kernel/04.02/wars/admin-ui/... //ci-admin-ui-4.2/...</projectPath>
              <projectOptions>noallwrite clobber nocompress unlocked nomodtime rmdir</projectOptions>
              <p4SysDrive></p4SysDrive>
              <p4SysRoot></p4SysRoot>
              <p4Tool>2012.2</p4Tool>
              <useClientSpec>false</useClientSpec>
              <useStreamDepot>false</useStreamDepot>
              <forceSync>false</forceSync>
              <alwaysForceSync>true</alwaysForceSync>
              <dontUpdateServer>false</dontUpdateServer>
              <disableAutoSync>false</disableAutoSync>
              <disableChangeLogOnly>false</disableChangeLogOnly>
              <disableSyncOnly>false</disableSyncOnly>
              <showIntegChanges>false</showIntegChanges>
              <useOldClientName>false</useOldClientName>
              <createWorkspace>true</createWorkspace>
              <updateView>true</updateView>
              <dontRenameClient>false</dontRenameClient>
              <updateCounterValue>false</updateCounterValue>
              <dontUpdateClient>false</dontUpdateClient>
              <exposeP4Passwd>true</exposeP4Passwd>
              <wipeBeforeBuild>false</wipeBeforeBuild>
              <quickCleanBeforeBuild>false</quickCleanBeforeBuild>
              <restoreChangedDeletedFiles>false</restoreChangedDeletedFiles>
              <wipeRepoBeforeBuild>false</wipeRepoBeforeBuild>
              <firstChange>-1</firstChange>
              <fileLimit>0</fileLimit>
              <excludedFilesCaseSensitivity>true</excludedFilesCaseSensitivity>
              <slaveClientNameFormat>${basename}-${hash}</slaveClientNameFormat>
              <lineEndValue>local</lineEndValue>
              <useViewMask>false</useViewMask>
              <useViewMaskForPolling>true</useViewMaskForPolling>
              <useViewMaskForSyncing>false</useViewMaskForSyncing>
              <useViewMaskForChangeLog>false</useViewMaskForChangeLog>
              <pollOnlyOnMaster>false</pollOnlyOnMaster>
            </scm>
          

          Below is a snippet from the  jenkins2 job config.xml  'scm class' plugin="p4@1.10.12" AFTER the upgrade
          The new scm class does NOT specify the <p4Client>**

           

            <scm class="org.jenkinsci.plugins.p4.PerforceScm" plugin="p4@1.10.12">
              <credential>p4-userpass</credential>
              <workspace class="org.jenkinsci.plugins.p4.workspace.ManualWorkspaceImpl">
                <charset>none</charset>
                <pinHost>true</pinHost>
                <cleanup>false</cleanup>
                <name>jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}</name>
                <spec>
                  <allwrite>false</allwrite>
                  <clobber>true</clobber>
                  <compress>false</compress>
                  <locked>false</locked>
                  <modtime>false</modtime>
                  <rmdir>false</rmdir>
                  <streamName></streamName>
                  <line>LOCAL</line>
                  <view>//depot/kernel/04.02/wars/admin-ui/... //${P4_CLIENT}/...</view>
                  <changeView></changeView>
                  <type>WRITABLE</type>
                  <serverID></serverID>
                  <backup>true</backup>
                </spec>
              </workspace>
              <populate class="org.jenkinsci.plugins.p4.populate.AutoCleanImpl">
                <have>true</have>
                <force>false</force>
                <modtime>false</modtime>
                <quiet>true</quiet>
                <pin></pin>
                <parallel>
                  <enable>false</enable>
                  <threads>4</threads>
                  <minfiles>1</minfiles>
                  <minbytes>1024</minbytes>
                </parallel>
                <replace>true</replace>
                <delete>true</delete>
                <tidy>false</tidy>
              </populate>
            </scm>
          

           

           

           

           

           

           

           

           

           

          David Rodriguez added a comment - - edited Hi Karl, I really appreciate the quick response to my issue.  What I'm attempting to do is test upgrading our Jenkins1 (v1.651.2) environment to Jenkins2 (v2.222.1) before upgrading our production jenkin server and slaves.  I was  hoping that the upgrade was simply allowing the new p4@1.10.12 plugin manage the necessary scm class changes to create the p4 client to run the job without having to make additional changes.  Note that we are NOT using P4Maven for our Perforce jobs. Below is a snippet from the  jenkins1 job config.xml  versus the jenkins2 job config.xml  after the upgrade. Note that the jenkins1 job.xml specifies the p4client and the jenkins2 job.xml does NOT .  Is there a reason for that?  I also attached the jenkins1 job config.xml and build log before the upgrade for your review. Snippet from the  jenkins1 job config.xml  'scm class' for plugin="perforce@1.3.35" BEFORE the upgrade. The scm class specifies the tag <p4Client>ci-admin-ui-4.2 </p4Client> . <scm class= "hudson.plugins.perforce.PerforceSCM" plugin= "perforce@1.3.35" > <configVersion>2</configVersion> <p4User>compil</p4User> <p4Passwd>0f0kqlwaRgSE9uduYTPfa3AlrK8xqw==</p4Passwd> <p4Port>p4proxy:1667</p4Port> --> <p4Client>ci-admin-ui-4.2</p4Client> <projectPath> //depot/kernel/04.02/wars/admin-ui/... //ci-admin-ui-4.2/...</projectPath> <projectOptions>noallwrite clobber nocompress unlocked nomodtime rmdir</projectOptions> <p4SysDrive></p4SysDrive> <p4SysRoot></p4SysRoot> <p4Tool>2012.2</p4Tool> <useClientSpec> false </useClientSpec> <useStreamDepot> false </useStreamDepot> <forceSync> false </forceSync> <alwaysForceSync> true </alwaysForceSync> <dontUpdateServer> false </dontUpdateServer> <disableAutoSync> false </disableAutoSync> <disableChangeLogOnly> false </disableChangeLogOnly> <disableSyncOnly> false </disableSyncOnly> <showIntegChanges> false </showIntegChanges> <useOldClientName> false </useOldClientName> <createWorkspace> true </createWorkspace> <updateView> true </updateView> <dontRenameClient> false </dontRenameClient> <updateCounterValue> false </updateCounterValue> <dontUpdateClient> false </dontUpdateClient> <exposeP4Passwd> true </exposeP4Passwd> <wipeBeforeBuild> false </wipeBeforeBuild> <quickCleanBeforeBuild> false </quickCleanBeforeBuild> <restoreChangedDeletedFiles> false </restoreChangedDeletedFiles> <wipeRepoBeforeBuild> false </wipeRepoBeforeBuild> <firstChange>-1</firstChange> <fileLimit>0</fileLimit> <excludedFilesCaseSensitivity> true </excludedFilesCaseSensitivity> <slaveClientNameFormat>${basename}-${hash}</slaveClientNameFormat> <lineEndValue>local</lineEndValue> <useViewMask> false </useViewMask> <useViewMaskForPolling> true </useViewMaskForPolling> <useViewMaskForSyncing> false </useViewMaskForSyncing> <useViewMaskForChangeLog> false </useViewMaskForChangeLog> <pollOnlyOnMaster> false </pollOnlyOnMaster> </scm> Below is a snippet from the  jenkins2 job config.xml  'scm class' plugin="p4@1.10.12" AFTER the upgrade The new scm class does NOT specify the <p4Client>**   <scm class= "org.jenkinsci.plugins.p4.PerforceScm" plugin= "p4@1.10.12" > <credential>p4-userpass</credential> <workspace class= "org.jenkinsci.plugins.p4.workspace.ManualWorkspaceImpl" > <charset>none</charset> <pinHost> true </pinHost> <cleanup> false </cleanup> <name>jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}</name> <spec> <allwrite> false </allwrite> <clobber> true </clobber> <compress> false </compress> <locked> false </locked> <modtime> false </modtime> <rmdir> false </rmdir> <streamName></streamName> <line>LOCAL</line> <view> //depot/kernel/04.02/wars/admin-ui/... //${P4_CLIENT}/...</view> <changeView></changeView> <type>WRITABLE</type> <serverID></serverID> <backup> true </backup> </spec> </workspace> <populate class= "org.jenkinsci.plugins.p4.populate.AutoCleanImpl" > <have> true </have> <force> false </force> <modtime> false </modtime> <quiet> true </quiet> <pin></pin> <parallel> <enable> false </enable> <threads>4</threads> <minfiles>1</minfiles> <minbytes>1024</minbytes> </parallel> <replace> true </replace> <delete> true </delete> <tidy> false </tidy> </populate> </scm>                  
          Karl Wirth made changes -
          Attachment New: image-2020-04-20-13-40-22-145.png [ 51004 ]

          Karl Wirth added a comment -

          Hi drodspike,

          Thanks.

          The SCM class not longer hard codes all that information. In later versions of the plugin everything is built on the fly. So instead of specifying P4PORT and P4USER you pull in the Jenkins credential that encapsulates P4PORT, P4USER and P4PASSWD:

          <credential>p4-userpass</credential>
          

          P4CLIENT is also dynamically built based on 'name':

          <name>jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}</name>
          

          For example if your node is WIN10, your job is mybuild and it runs on executor (Jenkins build thread) 1 the P4CLIENT (variable P4_CLIENT) would be:

          jenkins-WIN10-mybuild-1
          

          If you knew the job only ever runs on one node you could hard code the client name in the job definition to be 'ci-admin-ui-4.2'.

           

          As for the error its occurring after P4Jenkins has finished and after the command "/data/jenkins_home/tools/apache-maven-3.6.3/bin/mvn -s " has executed. Also P4Jenkins doesnt use the 'p4' binary it uses P4Java that is dynamically sent to the slave as teh job executes:

          ha:////4Lo+a7u/lzaTkq1HGH3U8JSMfSgah36g77z15FvpSvDYAAAAYB+LCAAAAAAAAP9b85aBtbiIQSmjNKU4P0+vJLE4u1gvPjexLDVPzxdEuhYV5Rf55ZekOlc7RKnPKH7IxMBQUcQgBdWQnJ9XnJ+TqucMoUEKGSCAEaSwAACsNFCqYAAAAA==[ERROR] Failed to execute goal com.mycom:mycom-build-info-plugin:1.0.14:create (vernum) on project admin.ui: Unable to fetch p4 head version for path/data/jenkins_home/workspace/admin-ui-4.2: P4 process `/bin/sh -c p4 -d /data/jenkins_home/workspace/admin-ui-4.2 changes -m1 ...` returned error code;rc;1;Error message;... - must create client 'ip-10-21-2-84' to access local files. -> [Help 1]
          

          Note that it's running '/bin/sh -c p4'. So if this is not Maven then it is another script or job that is being executed by the Jenkins job.

          The problem is that the P4CLIENT being built on the fly is not being passed to the environment that the job is executing under which is why I think it needs to be passed or picked up explicitly. For example if it's bash try using 'export P4CLIENT=P4_CLIENT'.

          For example below is the output when I run a shell script from the job that displaye P4CLIENT and P4_CLIENT:

          Note that P4CLIENT is not set but P4_CLIENT is.

           

           

           

           

          Karl Wirth added a comment - Hi drodspike , Thanks. The SCM class not longer hard codes all that information. In later versions of the plugin everything is built on the fly. So instead of specifying P4PORT and P4USER you pull in the Jenkins credential that encapsulates P4PORT, P4USER and P4PASSWD: <credential>p4-userpass</credential> P4CLIENT is also dynamically built based on 'name': <name>jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}</name> For example if your node is WIN10, your job is mybuild and it runs on executor (Jenkins build thread) 1 the P4CLIENT (variable P4_CLIENT) would be: jenkins-WIN10-mybuild-1 If you knew the job only ever runs on one node you could hard code the client name in the job definition to be 'ci-admin-ui-4.2'.   As for the error its occurring after P4Jenkins has finished and after the command "/data/jenkins_home/tools/apache-maven-3.6.3/bin/mvn -s " has executed. Also P4Jenkins doesnt use the 'p4' binary it uses P4Java that is dynamically sent to the slave as teh job executes: ha: ////4Lo+a7u/lzaTkq1HGH3U8JSMfSgah36g77z15FvpSvDYAAAAYB+LCAAAAAAAAP9b85aBtbiIQSmjNKU4P0+vJLE4u1gvPjexLDVPzxdEuhYV5Rf55ZekOlc7RKnPKH7IxMBQUcQgBdWQnJ9XnJ+TqucMoUEKGSCAEaSwAACsNFCqYAAAAA==[ERROR] Failed to execute goal com.mycom:mycom-build-info-plugin:1.0.14:create (vernum) on project admin.ui: Unable to fetch p4 head version for path/data/jenkins_home/workspace/admin-ui-4.2: P4 process `/bin/sh -c p4 -d /data/jenkins_home/workspace/admin-ui-4.2 changes -m1 ...` returned error code;rc;1;Error message;... - must create client 'ip-10-21-2-84' to access local files. -> [Help 1] Note that it's running '/bin/sh -c p4'. So if this is not Maven then it is another script or job that is being executed by the Jenkins job. The problem is that the P4CLIENT being built on the fly is not being passed to the environment that the job is executing under which is why I think it needs to be passed or picked up explicitly. For example if it's bash try using 'export P4CLIENT=P4_CLIENT'. For example below is the output when I run a shell script from the job that displaye P4CLIENT and P4_CLIENT: Note that P4CLIENT is not set but P4_CLIENT is.        
          David Rodriguez made changes -
          Attachment New: jenkins1-job-config.xml [ 51010 ]

            p4kevin Kevin Williamson
            drodspike David Rodriguez
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: