-
Bug
-
Resolution: Unresolved
-
Minor
-
Jenkins 2.276 (Windows)
P4 Plugin 1.11.2
The following problem was observed in a pipeline type job:
After the perforce scm step is executed the P4_ROOT environment variable is not set properly. It is pointing to the build workspace instead of the p4 client root of the client used during the scm step. I have tested it using static workspace behavior and the p4 preview option. Basically the P4_ROOT is the same as WORKSPACE environment variable, but it should be set to p4 clients root.
agent{ node{ label "node1" customWorkspace "C:\\Custom\\BuildWorkspacePath" } } stages{ stage('Test'){ steps{ // Perforce client myP4Client has p4 root set to C:\\myP4Client checkout perforce(credential: 'myP4Creds', populate: previewOnly(quiet: true), workspace: staticSpec(charset: 'none', name: 'myP4Client', pinHost: false)) // P4_ROOT will be set to "C:\\Custom\\BuildWorkspacePath" instead of "C:\\myP4Client" echo "${currentBuild.rawBuild.getEnvironment()}" } } }
- is caused by
-
JENKINS-47005 Let user specify p4 workspace root in manual config
-
- Open
-
Hi plawniczuk . At the moment you cannot set a workspace root as you have found because the build needs to be done under the Jenkins workspace root. In the past I have recomended using the 'ws' directive. For example I give an example here:
https://issues.jenkins.io/browse/JENKINS-47005
Is 'customWorkspace' different to 'ws'? Can you please try 'ws' and see if that solves the problem. Also note that if you are using multiple build slaves and the build can run on any slave please ensure that the node name and job appear in the client name of any real scripts. For example:
jenkins-${NODE_NAME}
${JOB_NAME}${EXECUTOR_NUMBER}