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

git scm poll doesn't ignore changes with pipeline

      We are using the job as attached with the groovy test.groovy file. We poll the SCM for changes but want to ignore any change that is in our jenkins-jobs git repo. This is because in a full setup we poll more repositories which do change. In the jenkins pipeline we use .* as exclude region. This does work unless we clone the same repository in our test.groovy. There we say poll=false, but the repository is polled and at the moment we make a commit to jenkins-jobs.git the job is run. With these configuration we would expect this job to never run, even when we schedule it frequrently

        1. config.xml
          2 kB
        2. test.groovy
          0.2 kB

          [JENKINS-38508] git scm poll doesn't ignore changes with pipeline

          Johnny Willemsen created issue -
          Jesse Glick made changes -
          Component/s New: workflow-scm-step-plugin [ 21717 ]
          Component/s Original: workflow-cps-plugin [ 21713 ]

          Jesse Glick added a comment -

          Would need to study your example more closely since so far I do not understand it. (Generally, steps to reproduce from scratch are more helpful than explanations.) Possibly same as JENKINS-38659.

          Jesse Glick added a comment - Would need to study your example more closely since so far I do not understand it. (Generally, steps to reproduce from scratch are more helpful than explanations.) Possibly same as JENKINS-38659 .
          Jesse Glick made changes -
          Link New: This issue relates to JENKINS-38659 [ JENKINS-38659 ]

          I also don't 100% understand it. Mostly it seems the polling does work, but in some cases we still see jobs to run even when nothing changed

          Johnny Willemsen added a comment - I also don't 100% understand it. Mostly it seems the polling does work, but in some cases we still see jobs to run even when nothing changed

          Martin Sander added a comment - - edited

          JENKINS-39621 might also be related.

          Martin Sander added a comment - - edited JENKINS-39621 might also be related.
          Martin Sander made changes -
          Link New: This issue relates to JENKINS-39621 [ JENKINS-39621 ]

          Jukka Lehtniemi added a comment - - edited

          I can reproduce this (Jenkins 2.43, Git plugin 3.0.1, Pipeline plugin 2.4).

          Steps to reproduce:

          1. Create a test repository:
            git init /tmp/testrepo; cd /tmp/testrepo; echo foo > foo; git add foo; git commit -m foo
            
          2. Create a new pipeline job with script:
            properties([pipelineTriggers([pollSCM('* * * * *')])])
            node("master") {
                git(url: '/tmp/testrepo', poll:false)
            }
            
          3. Trigger the pipeline once manually
          4. Commit more content to the test repository
             
            echo foo2 >> foo; git commit -a -m foo2
            
          5. Observe how the build is being triggered in a minute even if the poll=false is set

          Jukka Lehtniemi added a comment - - edited I can reproduce this (Jenkins 2.43, Git plugin 3.0.1, Pipeline plugin 2.4). Steps to reproduce: Create a test repository: git init /tmp/testrepo; cd /tmp/testrepo; echo foo > foo; git add foo; git commit -m foo Create a new pipeline job with script: properties([pipelineTriggers([pollSCM( '* * * * *' )])]) node( "master" ) { git(url: '/tmp/testrepo' , poll: false ) } Trigger the pipeline once manually Commit more content to the test repository echo foo2 >> foo; git commit -a -m foo2 Observe how the build is being triggered in a minute even if the poll=false is set
          Jukka Lehtniemi made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]

          Pavel Georgiev added a comment - - edited

          I'm not sure if this is the correct defect but im my case when i checkout a git repo using the checkout step anc configure poll: false i see in the git pooling log that this repo is being checked for changes....

          node('build') {

          checkout changelog: false, poll: false,
          scm: [$class: 'GitSCM',
          branches: [[name: '*/master']],
          doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [],
          userRemoteConfigs: [[credentialsId: 'git_ci_credentials', url: 'https://hidden']]]
          }

          The pooling log:

          Using strategy: Default
          [poll] Last Built Revision: Revision hidden (refs/remotes/origin/master)
          using GIT_ASKPASS to set credentials git_ci_credentials
          > git ls-remote -h https://hidden # timeout=10
          Found 6 remote heads on https://hidden
          [poll] Latest remote head revision on refs/heads/master is: hidden - already built by 171
          Done. Took 5.8 sec
          No changes

          Pavel Georgiev added a comment - - edited I'm not sure if this is the correct defect but im my case when i checkout a git repo using the checkout step anc configure poll: false i see in the git pooling log that this repo is being checked for changes.... node('build') { checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [ [name: '*/master'] ], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [ [credentialsId: 'git_ci_credentials', url: 'https:// hidden '] ]] } The pooling log: Using strategy: Default [poll] Last Built Revision: Revision hidden (refs/remotes/origin/master) using GIT_ASKPASS to set credentials git_ci_credentials > git ls-remote -h https:// hidden # timeout=10 Found 6 remote heads on https:// hidden [poll] Latest remote head revision on refs/heads/master is: hidden - already built by 171 Done. Took 5.8 sec No changes

            Unassigned Unassigned
            jwillemsen Johnny Willemsen
            Votes:
            17 Vote for this issue
            Watchers:
            27 Start watching this issue

              Created:
              Updated: