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

'Polling latest change with pin' option does not find changes beyond pinned changelist when combined with lightweight checkout

XMLWordPrintable

      When using the "Polling latest change with pin" build filter combined with the lightweight checkout option, new changelists are not detected and do not trigger new builds.  This combination of features results in a polling range of @pin,pin instead of the @now polling range, which causes the change to not be detected.

      We have multiple Jenkins workers which need to run over the same Perforce changelist. We're using the P4 plugin (V1.16.0) to do this (using the p4sync groovy function). Our configuration is using pins to sync with perforce. We've set the Polling latest change with pin option, alongside a lightweight checkout to retrieve our Jenkinsfile. Our Jenkinsfile uses p4sync function to pull in our project and run our build. __

      I've included a sample of our code below:

       

      def autoClean = [
                      $class: 'AutoCleanImpl',
                      delete  : clean,
                      modtime : false,
                      parallel: [enable: false, minbytes: '1024', minfiles: '1', threads: '4'],
                      pin     : "${changelist}",
                      quiet   : false,
                      replace : this.clean,
                      tidy    : false
                  ]            
      p4sync(
                      charset     : 'none',
                      credential  : p4Credentials,
                      populate    : autoClean,
                      source      : streamSource(streamPath),
                      workspace   : manualSpec(
                          charset : 'none',
                          name    : p4ClientSpec,
                          spec    : [
                              allwrite    : false,
                              clobber     : true,
                              compress    : false,
                              line        : 'UNIX',
                              locked      : false,
                              modtime     : false,
                              rmdir       : true,
                              streamName  : streamPath,
                              view        : "${streamPath}... ${p4ClientSpec}/..."
                          ]
                      )
                  ) 

      Here are a few screenshots of our configuration within Jenkins:

       

      Our Perforce configuration is as follows:

      After running this, I trigger a Perforce trigger by sending a curl request to our /p4/change endpoint. The request is accepted with a 200 OK response, however the new changelist is not detected. The polling log displays the following:

      no polling baseline in <WORKSPACE> on 
      Executor number at runtime: 0
      P4: Polling on: master with:jenkins-<WORKSPACE> Found last change 90466 on syncID jenkins-<WORKSPACE> ... p4 login +
      ... p4 login -s +
      ... p4 client -o jenkins-<WORKSPACE> +
      ... p4 info +
      ... p4 info +
      ... p4 client -o jenkins-UE-<WORKSPACE> +
      ... p4 client -i +
      ...   View: +P4 Task: establishing connection.
      ... server: perforce:1666
      ... node: jenkins
      P4: Polling with range: 90466,90466
      ... p4 changes -m20 //jenkins-<WORKSPACE>/...@90466,90466 +
      ... p4 repos -C +
      P4: Polling no changes found.
      P4: No changes 

      As you can see, the p4 changes command is using a range of @90466,90466. Based off the discussion in this issue: https://issues.jenkins.io/browse/JENKINS-63879, it seems that Polling latest with Pin should set the polling range to now, however based on the polling results, it does not poll to the latest revision.

       

      Disabling Lightweight Checkout updates the polling range to now, and finds the latest changelist.

            Unassigned Unassigned
            sweepy Aryeh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: