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

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

    • 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.

       

       

          [JENKINS-47553] Pipeline 'poll' option in checkout ignored if using libraries for sync

          Wei Luo added a comment - - edited

          Hi Karl,

          I am using same version of Jenkins and P4 plugin and very similar shared lib and pipelineJob.

          Here is error when I tried to run the job. Have you seen this error?

           
          hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: perforce.call() is applicable for argument types: (java.util.LinkedHashMap) values: [[credential:6e6c9271-a04f-4795-b4b8-xxx, populate:@forceClean(have=false,parallel=

          {enable=true, minbytes=1024, minfiles=1, threads=4}

          ,pin=,quiet=true), ...]]
          Possible solutions: call(java.lang.String, java.lang.String), call(java.lang.String, java.lang.String, java.lang.String), wait(), any(), wait(long), main([Ljava.lang.String
          at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
          Please advise,

           

          Thanks

          Wei Luo added a comment - - edited Hi Karl, I am using same version of Jenkins and P4 plugin and very similar shared lib and pipelineJob. Here is error when I tried to run the job. Have you seen this error?   hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: perforce.call() is applicable for argument types: (java.util.LinkedHashMap) values: [[credential:6e6c9271-a04f-4795-b4b8-xxx, populate:@forceClean(have=false,parallel= {enable=true, minbytes=1024, minfiles=1, threads=4} ,pin=,quiet=true), ...]] Possible solutions: call(java.lang.String, java.lang.String), call(java.lang.String, java.lang.String, java.lang.String), wait(), any(), wait(long), main([Ljava.lang.String at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58) Please advise,   Thanks

          Jay Spang added a comment - - edited

          I'm seeing this bug as well. My pipeline checks out from 2 separate streams: The 1st is my app's source code, the 2nd is just various deployment tools that are synced from a shared library. My job is doing what I've come to call "runaway polling", where every time it polls, it thinks there's a new change and builds the project again.

          Here is the code I'm using for the second checkout: (trimmed down for readability)

          checkout changelog: false, poll: false, scm: perforce( populate: syncOnly(), workspace: streamSpec(name: jenkins-${NODE_NAME}-${JOB_NAME}-deploy-scripts) )

          And despite this, the last lines of the polling log contain this:

          P4: Polling on: master with:jenkins-master-jobName-deploy-scripts
          Done. Took 0.65 sec
          Changes found

          I don't know why it's trying to poll even though I explicitly said not to, and I don't know why the polling is exiting immediately claiming it found changes, but the combination of this is resulting in "runaway polling".

          Jay Spang added a comment - - edited I'm seeing this bug as well. My pipeline checks out from 2 separate streams: The 1st is my app's source code, the 2nd is just various deployment tools that are synced from a shared library. My job is doing what I've come to call "runaway polling", where every time it polls, it thinks there's a new change and builds the project again. Here is the code I'm using for the second checkout: (trimmed down for readability) checkout changelog: false, poll: false, scm: perforce( populate: syncOnly(), workspace: streamSpec(name: jenkins-${NODE_NAME}-${JOB_NAME}-deploy-scripts) ) And despite this, the last lines of the polling log contain this: P4: Polling on: master with:jenkins-master-jobName-deploy-scripts Done. Took 0.65 sec Changes found I don't know why it's trying to poll even though I explicitly said not to, and I don't know why the polling is exiting immediately claiming it found changes, but the combination of this is resulting in "runaway polling".

          Paul Allen added a comment -

          Hi p4karl, please can you check this using different workspace names. Thanks, Paul

          Paul Allen added a comment - Hi p4karl , please can you check this using different workspace names. Thanks, Paul

          Paul Allen added a comment -

          Closing - need more detail.  Global Library update in release 1.9.3 my change behaviour. Please reopen if required.

          Paul Allen added a comment - Closing - need more detail.  Global Library update in release 1.9.3 my change behaviour. Please reopen if required.

          siddardha sarabu added a comment - - edited

          Hi Paul Allen,

          This issue is still present with Jenkins 2.197 version.

          checkout (for additional repositories) on a custom step defined in shared library with poll=false still polls for changes and triggers jenkins builds.

          siddardha sarabu added a comment - - edited Hi Paul Allen, This issue is still present with Jenkins 2.197 version. checkout (for additional repositories) on a custom step defined in shared library with poll=false still polls for changes and triggers jenkins builds.

          Karl Wirth added a comment -

          Hi siddhu268 - Thanks. I'll test and get back to you.

          Notes for me - is this also linked to JENKINS-56248?

          Karl Wirth added a comment - Hi siddhu268 - Thanks. I'll test and get back to you. Notes for me - is this also linked to JENKINS-56248 ?

          Karl Wirth added a comment -

          Hi siddhu268 - I confirm this still occurs on 1.10.6:

          Perforce Software Polling LogStarted on Nov 12, 2019 11:56:40 AM
          no polling baseline in /var/lib/jenkins/workspace/JENKINS-47553-LibraryNoPoll@libs/my-shared-library on 
          P4: Polling on: master with:jenkins-master-JENKINS-47553-LibraryNoPoll-src1
          Found last change 2123 on syncID jenkins-NODE_NAME-JENKINS-47553-LibraryNoPoll-src1
          ... p4 login -s +
          ... p4 client -o jenkins-master-JENKINS-47553-LibraryNoPoll-src1 +
          ... p4 info +
          ... p4 info +
          ... p4 client -o jenkins-master-JENKINS-47553-LibraryNoPoll-src1 +P4 Task: establishing connection.
          ... server: vm-kwirth-swarm182-xenial:1666
          ... node: vm-kwirth-swarm182-xenial
          P4: Polling with range: 2123,now
          ... p4 changes -m20 //jenkins-master-JENKINS-47553-LibraryNoPoll-src1/...@2123,now +
          ... p4 repos -C +
          P4: Polling no changes found.
          P4: Polling on: master with:jenkins-master-JENKINS-47553-LibraryNoPoll-src2
          Found last change 2123 on syncID jenkins-NODE_NAME-JENKINS-47553-LibraryNoPoll-src2
          ... p4 login -s +
          ... p4 client -o jenkins-master-JENKINS-47553-LibraryNoPoll-src2 +
          ... p4 info +
          ... p4 info +
          ... p4 client -o jenkins-master-JENKINS-47553-LibraryNoPoll-src2 +P4 Task: establishing connection.
          ... server: vm-kwirth-swarm182-xenial:1666
          ... node: vm-kwirth-swarm182-xenial
          P4: Polling with range: 2123,now
          ... p4 changes -m20 //jenkins-master-JENKINS-47553-LibraryNoPoll-src2/...@2123,now +
          ... p4 change -o 2124 +
          ... found change: 2124
          ... p4 repos -C +
          P4: Polling found change: 2124
          Done. Took 73 ms
          Changes found
          

          The change that caused this was part of the //depot/no-poll path from the abive-example:

          $ p4 describe -s 2124 Change 2124 by super@test_ws on 2019/11/12 11:56:36
             Submit of ./f2124
           Affected files ...
             ... //depot/no-poll/f2124#1 add
          

          I believe this is the same issue as JENKINS-56248.

           

           

           

           

          Karl Wirth added a comment - Hi siddhu268 - I confirm this still occurs on 1.10.6: Perforce Software Polling LogStarted on Nov 12, 2019 11:56:40 AM no polling baseline in / var /lib/jenkins/workspace/JENKINS-47553-LibraryNoPoll@libs/my-shared-library on P4: Polling on: master with:jenkins-master-JENKINS-47553-LibraryNoPoll-src1 Found last change 2123 on syncID jenkins-NODE_NAME-JENKINS-47553-LibraryNoPoll-src1 ... p4 login -s + ... p4 client -o jenkins-master-JENKINS-47553-LibraryNoPoll-src1 + ... p4 info + ... p4 info + ... p4 client -o jenkins-master-JENKINS-47553-LibraryNoPoll-src1 +P4 Task: establishing connection. ... server: vm-kwirth-swarm182-xenial:1666 ... node: vm-kwirth-swarm182-xenial P4: Polling with range: 2123,now ... p4 changes -m20 //jenkins-master-JENKINS-47553-LibraryNoPoll-src1/...@2123,now + ... p4 repos -C + P4: Polling no changes found. P4: Polling on: master with:jenkins-master-JENKINS-47553-LibraryNoPoll-src2 Found last change 2123 on syncID jenkins-NODE_NAME-JENKINS-47553-LibraryNoPoll-src2 ... p4 login -s + ... p4 client -o jenkins-master-JENKINS-47553-LibraryNoPoll-src2 + ... p4 info + ... p4 info + ... p4 client -o jenkins-master-JENKINS-47553-LibraryNoPoll-src2 +P4 Task: establishing connection. ... server: vm-kwirth-swarm182-xenial:1666 ... node: vm-kwirth-swarm182-xenial P4: Polling with range: 2123,now ... p4 changes -m20 //jenkins-master-JENKINS-47553-LibraryNoPoll-src2/...@2123,now + ... p4 change -o 2124 + ... found change: 2124 ... p4 repos -C + P4: Polling found change: 2124 Done. Took 73 ms Changes found The change that caused this was part of the //depot/no-poll path from the abive-example: $ p4 describe -s 2124 Change 2124 by super @test_ws on 2019/11/12 11:56:36 Submit of ./f2124 Affected files ... ... //depot/no-poll/f2124#1 add I believe this is the same issue as JENKINS-56248 .        

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

              Created:
              Updated: