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

Pipeline 'poll' option in checkout ignored if using libraries for sync

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • p4-plugin
    • Jenkins 2.73.2
      p4-plugin 1.7.7

      The 'checkout' step can have a poll true or false option. If used in a jenkinsfile P4-Jenkins respects this. If it appears in a global library, the poll false option is ignored and polling still occurs on the non poll checkout.

       

      Reproduction steps:

      (1) Create a Groovy library with the 2 function. One that polls, one that does not.

       

      package org.foo;
      
      def testNoPoll ()
      {
      echo "In library - test No Poll..."
      checkout poll: false, scm: perforce(credential: 'JenkinsMasterSuper', populate: autoClean(delete: true, modtime: false, parallel: [enable: false, minbytes: '1024', minfiles: '1', threads: '4'], pin: '', quiet: true, replace: true, tidy: false), workspace: manualSpec(charset: 'none', name: 'jenkins-${NODE_NAME}-${JOB_NAME}', pinHost: false, spec: clientSpec(allwrite: false, backup: false, clobber: false, compress: false, line: 'LOCAL', locked: false, modtime: false, rmdir: false, serverID: '', streamName: '', type: 'WRITABLE', view: '//depot/no-poll/... //jenkins-${NODE_NAME}-${JOB_NAME}-src2/...')))
      }
      
      def testPoll ()
      {
      echo "In library - test Poll..."
      checkout perforce(credential: 'JenkinsMasterSuper', populate: autoClean(delete: true, modtime: false, parallel: [enable: false, minbytes: '1024', minfiles: '1', threads: '4'], pin: '', quiet: true, replace: true, tidy: false), workspace: manualSpec(charset: 'none', name: 'jenkins-${NODE_NAME}-${JOB_NAME}', pinHost: false, spec: clientSpec(allwrite: false, backup: false, clobber: false, compress: false, line: 'LOCAL', locked: false, modtime: false, rmdir: false, serverID: '', streamName: '', type: 'WRITABLE', view: '//depot/project1/main/... //jenkins-${NODE_NAME}-${JOB_NAME}-src1/...')))
      }
      
      return this;
      
      

      (2) Create a Jenkinsfile that calls the functions. For example:

       

       

      @Library('my-shared-library')
      import org.foo.lib.*
      
      pipeline {
        agent { label 'master' }
        stages {
          stage("Repro") {
            steps {
              script {
                 def z = new org.foo.lib()
                 z.testFunc()
                 z.testPoll ()
                 z.testNoPoll ()
              }
            }
          }
        }
      }
      
      

      (3) Setup polling to run every minute.

       

      (4) Submit a change in folder //depot/project1/main/...

      (5) Wait 2 minutes.

      (6) Build was triggered.

      (7) Submit change in //depot/no-poll/...

      (8) Wait 2 minutes.

      (9) Buld was triggered again when it should not have been triggered.

       

       

            p4paul Paul Allen
            p4karl Karl Wirth
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: