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

Pipeline P4_CHANGELIST populated from Jenkinsfile changelist, not from repo p4sync mappings in Jenkinsfile

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • p4-plugin, pipeline
    • None
    • Jenkins 2.48, P4 Plugin 1.4.14

      I am noticing an odd issue where our P4_CHANGELIST number is populated per the last set of changes to the Jenkinfs file, but not for any 'p4sync' calls in the Jenkinsfile itself.

      As an example, here's the initial Jenkinsfile sync snippet, notice the changelist "961423". From here on out, the P4_CHANGELIST variable will have that as it's changelist number.

      [... snip ...]
      P4 Task: reverting all pending and shelved revisions.
      ... p4 revert /home/jenkins/jobs/build-tip/workspace%40script/... +
      ... rm [abandoned files]
      duration: (106ms)
      
      ... p4 sync /home/jenkins/jobs/build-tip/workspace%40script/...#none +
      ... rm -rf /home/jenkins/jobs/build-tip/workspace%40script
      
      P4 Task: syncing files at change: 961423
      ... p4 sync -p /home/jenkins/jobs/build-tip/workspace%40script/...@961423 +
      duration: (158ms)
      
      P4 Task: saving built changes.
      Found last change 961423 on syncID jenkins-build-tip
      ... p4 client -o jenkins-build-tip +
      ... p4 info +
      ... p4 client -o jenkins-build-tip +
      ... p4 info +
      ... done
      [... snip ...]
      

      A little farther in my build, I have my actual repo mappings. Here's the sync log from it:

      [... snip ...]
      P4 Task: reverting all pending and shelved revisions.
      ... p4 revert /home/jenkins/workspace/build-tip/... +
      ... rm [abandoned files]
      duration: (160ms)
      
      ... p4 sync /home/jenkins/workspace/build-tip/...#none +
      ... rm -rf /home/jenkins/workspace/build-tip
      
      P4 Task: syncing files at change: 968942
      ... p4 sync -p /home/jenkins/workspace/build-tip/...@968942 +
      duration: 9m 8s
      
      P4 Task: saving built changes.
      Found last change 968924 on syncID jenkins-build-01
      ... p4 client -o jenkins-build-01 +
      ... p4 info +
      ... p4 changes //jenkins-build-01/...@968924,968942 +
      ... p4 changes -l -m1 @968942 +
      ... p4 user -o user1 +
      ... p4 describe -s 968942 +
      ... p4 fixes -c968942 +
      ... p4 changes -l -m1 @968936 +
      ... p4 user -o user2 +
      ... p4 describe -s 968936 +
      ... p4 fixes -c968936 +
      ... done
      [... snip ...]
      

      In the case above, I would expect P4_CHANGELIST to be 968942, as it is the newest changelist for the repo at that point in the Jenkinsfile. If I were to have a workflow step right after my p4sync call that did something like this:

      sh "echo ${env.P4_CHANGELIST}"
      

      I would want the output to be '968942', but right now, it outputs '961423'.

          [JENKINS-42411] Pipeline P4_CHANGELIST populated from Jenkinsfile changelist, not from repo p4sync mappings in Jenkinsfile

          Kyle Mott created issue -
          Kyle Mott made changes -
          Summary Original: Pipeline P4_CHANGELIST populated from Jenkinsfile, not from repo mappings in Jenkinsfile New: Pipeline P4_CHANGELIST populated from Jenkinsfile changelist, not from repo p4sync mappings in Jenkinsfile
          Paul Allen made changes -
          Resolution New: Not A Defect [ 7 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]
          Thomas Murphy made changes -
          Resolution Original: Not A Defect [ 7 ]
          Status Original: Closed [ 6 ] New: Reopened [ 4 ]
          Raghu made changes -
          Priority Original: Major [ 3 ] New: Blocker [ 1 ]

            Unassigned Unassigned
            kmott Kyle Mott
            Votes:
            5 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: