ExportXMLWordPrintable

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Major
    • Component/s: p4-plugin
    • Environment:
      p4-plugin 1.17.2
      Jenkins Version 2.555.1

      If a pinned checkout on multiple agents is used in a library, future polling breaks with the polling being limited to the pinned version.
       
      For example pin build job to 359 and future polling is stuck polling 359 to 359:

      WARNING: duplicate syncID found: jenkins-NODE_NAME-CASE01570400_PopulateDoesntWork_Pipeline_Lib_MultiNode_Test2-EXECUTOR_NUMBER
      Found last change 359 on syncID jenkins-NODE_NAME-CASE01570400_PopulateDoesntWork_Pipeline_Lib_MultiNode_Test2-EXECUTOR_NUMBER
      Found last change 359 on syncID jenkins-NODE_NAME-CASE01570400_PopulateDoesntWork_Pipeline_Lib_MultiNode_Test2-EXECUTOR_NUMBER
      WARNING: duplicate syncID found: jenkins-NODE_NAME-CASE01570400_PopulateDoesntWork_Pipeline_Lib_MultiNode_Test2-EXECUTOR_NUMBER
      ...cut...
      P4: Polling with range: 359,359

       
      Reproduction steps:
       
      Step (1) Install the p4-plugin and poll now plugs for ease of use.
       
      Step (2) Create a Perforce credential called JenkinsMaster.
       
      Step (3) Check in following file contents as //depot/myLibrary/src/org/foo/lib.groovy
       

      package org.foo; 
      def testCheckoutPin ()
      {
              def changelistToUse = ''
              if(env.CHANGELIST_TO_BUILD != null
                      && !env.CHANGELIST_TO_BUILD.isEmpty()) {
                      changelistToUse = env.CHANGELIST_TO_BUILD
                      echo "Syncing to changelist ${changelistToUse} on ${env.NODE_NAME}"
              }
              else {
                      echo "Syncing to latest changelist on ${env.NODE_NAME}"
              }
       
      echo "In function testCheckoutPin on ${NODE_NAME} using pin $changelistToUse"
      checkout perforce(credential: 'JenkinsMaster', populate: forceClean(have: false, parallel: [enable: false, minbytes: '1024', minfiles: '1', threads: '4'], pin: changelistToUse, quiet: false), workspace: manualSpec(charset: 'none', cleanup: false, name: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}', pinHost: false, spec: clientSpec(allwrite: false, backup: true, changeView: '', clobber: true, compress: false, line: 'LOCAL', locked: false, modtime: false, pollPath: '', rmdir: false, serverID: '', streamAtChange: '', streamName: '', type: 'WRITABLE', view: '//depot/Project1/main/... //${P4_CLIENT}/...')))
      }
      return this; 

       
      Step (4) Setup the above depot location to be a global library:
       

      Manage Jenkins > System > Global Trusted Pipeline Libraries > + Add 
       
      Name: my-shared-library
       
      Default version: now
       
      ModernSCM > Helix Library 
       
         Library Depot Path: //depot/myLibrary/...

       
      Step (5) - Create two build agents called 'Agent1' and 'Agent2' on Linux machines.
       
      Step (6) - Check in a file called "//depot/Project1/main/test.txt". The file can have any contents.
       
      Setp (7) - Under Triggers selct PollSCM and set schedule to '1 2 3 4 5'.
       
      Step (8) Use the following code in the pipeline.
       

      @Library('my-shared-library') 
      import org.foo.lib.* 
       
      pipeline {
          parameters {
              string(name: 'CHANGELIST_TO_BUILD', defaultValue: '')
          }
          agent none
          options { skipDefaultCheckout() }
          stages {
              stage('Test on Local Agent1') {
                  agent {
                      label 'Agent1'
                  }
                  steps {
      script {
         def z = new org.foo.lib() 
         z.testCheckoutPin()
      }
                  }
              }
              stage('Test on Local Agent2') {
                  agent {
                      label 'Agent2'
                  }
                  steps {
      script {
         def z = new org.foo.lib() 
         z.testCheckoutPin()
      }
                  }
              }
          }
      }

       
      Step (9) - Click Build With paramater - Job runs
       
      Step (10) - Click 'Poll Now' - No job runs.
       
      Step (11) - Submit a new revision of //depot/Project1/main/test.txt.
       
      Step (12) - Click 'Poll Now' - Job runs.
       
      Step (13) - Submit a new revision of //depot/Project1/main/test.txt.
       
      Step (14) - Click 'Build  With Paramaters' and set CHANGELIST_TO_BUILD to the changelist used in step 12.
       
      Step (15) - Click 'Poll Now' - Job fails to run.
       
      Step (16) - Submit a new revision of //depot/Project1/main/test.txt.
       
      Step (17) - Click 'Poll Now' - Job fails to run.

       

      Expected Behavior: Polling runs at step 15 and 17.

            Assignee:
            Unassigned
            Reporter:
            Karl Wirth
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: