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

[P4 Plugin] P4_ROOT is not set properly - pointing to build workspace instead of p4 client root

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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()}"
          }
        }
      }
      
      

        Attachments

          Issue Links

            Activity

            plawniczuk Piotr Ławniczuk created issue -
            plawniczuk Piotr Ławniczuk made changes -
            Field Original Value New Value
            Labels P4_ROOT
            plawniczuk Piotr Ławniczuk made changes -
            Labels P4_ROOT EnvironmentalVariable P4_ROOT
            plawniczuk Piotr Ławniczuk made changes -
            Labels EnvironmentalVariable P4_ROOT EnvironmentalVariable P4_ROOT environment-variables
            plawniczuk Piotr Ławniczuk made changes -
            Description 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.
            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.

             
            {code:java}
                agent{
                    node{
                        label "master"
                    }
                }
                parameters{
                    string (name: 'change', defaultValue: '', trim: true, description: '')
                    string (name: 'shelve', defaultValue: '', trim: true, description: '')
                }
                options{
                    buildDiscarder logRotator(numToKeepStr: '5')
                    timestamps()
                }
                stages{
                    stage('first'){
                        steps{
                            checkout perforce(credential: 'robot.obibok_1777', populate: previewOnly(quiet: true), workspace: staticSpec(charset: 'none', name: 'robot.obibok_IDK300_TESTSTREAM_development', pinHost: false))
                            echo "${currentBuild.rawBuild.getEnvironment()}"
                            setupPipeline(displayName: "test", description: "PS4")
                        }
                    }
                }
            }
            {code}
            plawniczuk Piotr Ławniczuk made changes -
            Description 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.

             
            {code:java}
                agent{
                    node{
                        label "master"
                    }
                }
                parameters{
                    string (name: 'change', defaultValue: '', trim: true, description: '')
                    string (name: 'shelve', defaultValue: '', trim: true, description: '')
                }
                options{
                    buildDiscarder logRotator(numToKeepStr: '5')
                    timestamps()
                }
                stages{
                    stage('first'){
                        steps{
                            checkout perforce(credential: 'robot.obibok_1777', populate: previewOnly(quiet: true), workspace: staticSpec(charset: 'none', name: 'robot.obibok_IDK300_TESTSTREAM_development', pinHost: false))
                            echo "${currentBuild.rawBuild.getEnvironment()}"
                            setupPipeline(displayName: "test", description: "PS4")
                        }
                    }
                }
            }
            {code}
            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.

             
            {code:java}
            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()}"
                }
              }
            }

            {code}
            plawniczuk Piotr Ławniczuk made changes -
            Description 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.

             
            {code:java}
            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()}"
                }
              }
            }

            {code}
            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.

             
            {code:java}
            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()}"
                }
              }
            }

            {code}
            p4karl Karl Wirth made changes -
            Link This issue is caused by JENKINS-47005 [ JENKINS-47005 ]
            p4karl Karl Wirth made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              plawniczuk Piotr Ławniczuk
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: