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

checkout step returns wrong P4_CLIENT when used in parallel step

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Postponed
    • Component/s: p4-plugin
    • Labels:
    • Environment:
      Jenkins LTS 2.73.3
      P4 Plugin 1.8.3
    • Similar Issues:

      Description

      Note that I can't repro this with a very small set of files to sync, so I'm using a path that has ~160MB at the moment. Found on a much larger job. Not sure where the dividing line is, but at this size it seems to be 100%.

      Test script:

      def syncWorkspace(branchName) {
          def workspaceSpec = templateSpec(charset: 'none', format: "Jenkins_Experiments_${branchName}_${env.NODE_NAME}",
                      pinHost: true, templateName: <template>)
      
          def p4Env = checkout scm: perforce(credential: <credentials>,
              populate: autoClean(delete: true, modtime: false, pin: '', quiet: true, replace: true, tidy: false), workspace: workspaceSpec)
      
          println "${p4Env}"
      }
      
      node() {
          parallel firstBranch: {
              def branchName = 'firstBranch'
              syncWorkspace(branchName)
          }, secondBranch: {
              def branchName = 'secondBranch'
              syncWorkspace(branchName)
          }
      }
      

      Output from the log statements:

      [secondBranch] [HUDSON_CHANGELOG_FILE:/var/lib/jenkins/jobs/Experiments/jobs/Test_P4Bug/builds/19/changelog0.xml, P4_CHANGELIST:13506, P4_CLIENT:Jenkins_Experiments_secondBranch_CGSERVER2, P4_PORT:192.168.0.51:1666, P4_TICKET:BB5D0811AB2A6ABE6D240C2E4A64A54B, P4_USER:headless]
      
      [firstBranch] [HUDSON_CHANGELOG_FILE:/var/lib/jenkins/jobs/Experiments/jobs/Test_P4Bug/builds/19/changelog0.xml, P4_CHANGELIST:13506, P4_CLIENT:Jenkins_Experiments_secondBranch_CGSERVER2, P4_PORT:192.168.0.51:1666, P4_TICKET:BB5D0811AB2A6ABE6D240C2E4A64A54B, P4_USER:headless]
      

      On occasion, firstBranch will return the P4_CLIENT of secondBranch, but every recent run of this script has returned secondBranch for both. I imagine other variables might also be wrong in the result if they weren't identical across both checkout steps, but I haven't checked.

        Attachments

          Activity

          Hide
          p4karl Karl Wirth added a comment -

          Known bug in Jenkins. For example if you print variable once, then that value changes (for example performing a second sync) then the variable remains stuck at the first value.

          If you do not read the variable before it changes (for example echo it) then the second value will be used.

          Will ensure the bug in Jenkins is raised.

          Show
          p4karl Karl Wirth added a comment - Known bug in Jenkins. For example if you print variable once, then that value changes (for example performing a second sync) then the variable remains stuck at the first value. If you do not read the variable before it changes (for example echo it) then the second value will be used. Will ensure the bug in Jenkins is raised.
          Hide
          p4paul Paul Allen added a comment -

          Unable to fix issue - Need Jenkins to fix the environment.

          Show
          p4paul Paul Allen added a comment - Unable to fix issue - Need Jenkins to fix the environment.
          Hide
          philmcardlecg Phil McArdle added a comment -

          Do you know the bug number of the underlying issue in Jenkins?

          Show
          philmcardlecg Phil McArdle added a comment - Do you know the bug number of the underlying issue in Jenkins?

            People

            • Assignee:
              p4karl Karl Wirth
              Reporter:
              philmcardlecg Phil McArdle
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: