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

6 views
Skip to first unread message

jwillemsen@remedy.nl (JIRA)

unread,
Sep 26, 2016, 10:14:02 AM9/26/16
to jenkinsc...@googlegroups.com
Johnny Willemsen created an issue
 
Jenkins / Bug JENKINS-38508
git scm poll doesn't ignore changes with pipeline
Issue Type: Bug Bug
Assignee: Unassigned
Attachments: config.xml, test.groovy
Components: workflow-cps-plugin
Created: 2016/Sep/26 2:13 PM
Priority: Minor Minor
Reporter: Johnny Willemsen

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

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

jglick@cloudbees.com (JIRA)

unread,
Oct 11, 2016, 6:06:01 PM10/11/16
to jenkinsc...@googlegroups.com
Jesse Glick updated an issue
Change By: Jesse Glick
Component/s: workflow-scm-step-plugin
Component/s: workflow-cps-plugin

jglick@cloudbees.com (JIRA)

unread,
Oct 11, 2016, 6:08:02 PM10/11/16
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-38508
 
Re: git scm poll doesn't ignore changes with pipeline

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.

jwillemsen@remedy.nl (JIRA)

unread,
Oct 12, 2016, 2:33:08 AM10/12/16
to jenkinsc...@googlegroups.com

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@sap.com (JIRA)

unread,
Jan 31, 2017, 7:13:02 AM1/31/17
to jenkinsc...@googlegroups.com

martin.sander@sap.com (JIRA)

unread,
Jan 31, 2017, 7:14:01 AM1/31/17
to jenkinsc...@googlegroups.com
Martin Sander edited a comment on Bug JENKINS-38508
JENKINS-39621 might also be affected related .

jukka.lehtniemi@gmail.com (JIRA)

unread,
Feb 1, 2017, 6:10:01 AM2/1/17
to jenkinsc...@googlegroups.com

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

Steps to reproduce:

  1. Create a testrepository:
    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@gmail.com (JIRA)

unread,
Feb 1, 2017, 6:14:01 AM2/1/17
to jenkinsc...@googlegroups.com
Jukka Lehtniemi edited a comment on Bug JENKINS-38508
I can reproduce this (Jenkins 2.43, Git plugin 3.0.1, Pipeline plugin 2.4).

Steps to reproduce:
# Create a testrepository:
{code}
git init /tmp/testrepo
}} ; cd /tmp/testrepo; echo foo > foo; git add foo; git commit -m foo
{code}
# Create a new pipeline job with script:
{code}

properties([pipelineTriggers([pollSCM('* * * * *')])])
node("master") {
    git(url: '/tmp/testrepo', poll:false)
}
{code}
# Trigger the pipeline once manually
# Commit more content to the test repository
{code}
echo foo2 >> foo; git commit -a -m foo2
{code}
# Observe how the build is being triggered in a minute even if the {{poll=false}} is set

jukka.lehtniemi@gmail.com (JIRA)

unread,
Feb 1, 2017, 6:15:01 AM2/1/17
to jenkinsc...@googlegroups.com

jukka.lehtniemi@gmail.com (JIRA)

unread,
Feb 1, 2017, 6:16:02 AM2/1/17
to jenkinsc...@googlegroups.com
Jukka Lehtniemi edited a comment on Bug JENKINS-38508
I can reproduce this (Jenkins 2.43, Git plugin 3.0.1, Pipeline plugin 2.4).

Steps to reproduce:
# Create a testrepository test repository :

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

pavel.vasilev.georgiev@gmail.com (JIRA)

unread,
Feb 14, 2017, 5:42:01 AM2/14/17
to jenkinsc...@googlegroups.com

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 hidden +#" class="external-link" rel="nofollow">https://+hidden +# timeout=10
Found 6 remote heads on hidden+" class="external-link" rel="nofollow">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.vasilev.georgiev@gmail.com (JIRA)

unread,
Feb 14, 2017, 5:44:02 AM2/14/17
to jenkinsc...@googlegroups.com
Pavel Georgiev edited a comment on Bug JENKINS-38508
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:// + {color:red}hidden{color} + ']]]

}

The pooling log:

Using strategy: Default
[poll] Last Built Revision: Revision + {color:red}hidden {color} + (refs/remotes/origin/master)

using GIT_ASKPASS to set credentials git_ci_credentials
> git ls-remote -h https:// + {color:red}hidden {color} + # timeout=10
Found 6 remote heads on https://
+ {color:red}hidden{color} +
[poll] Latest remote head revision on refs/heads/master is:
+ {color:red}hidden {color} + - already built by 171

Done. Took 5.8 sec
No changes

ansgar.binninger@ars.de (JIRA)

unread,
Feb 16, 2017, 3:49:02 AM2/16/17
to jenkinsc...@googlegroups.com
Ansgar B commented on Bug JENKINS-38508

I have here a small Explanation on StackOverflow with the same/similar case. Maybe it could help you to understand what the problem with the polling is.

http://stackoverflow.com/questions/40017034/jenkins-pipeline-poll-scm-with-different-repo-for-jenkinsfile-and-application-re

I try to summarize the problem we have at our company.

We have two repositories. One for the configuration of Jenkinsfiles (config-repo) and on for our Development (dev-repo).
In Jenkins we have 3 Jobs for deployment of the dev-repo. One for dev branch, one for hotfixe branch and one for release branch.

If i check new code into the config-repo, the builds aren't triggered, but if we check new code into dev-repo after a checkin/change in the config-repo all jobs configured with the config-repo and using the dev-repo starts a build.

The Jobs should never start a build after checkins into config-repo and only starts a build, if new code is checked into their specific branch.

me@ehaselwanter.com (JIRA)

unread,
Feb 17, 2017, 6:42:02 AM2/17/17
to jenkinsc...@googlegroups.com

same here.

    checkout(
      poll: true,
      scm: [
        $class: 'GitSCM',
        userRemoteConfigs: [[
          url: 'git@xxxxxx/deployed-service-versions.git',
          credentialsId: xxxxxx,
        ]],
        branches: [[name: '*/master']],
        extensions: [
          [$class: 'RelativeTargetDirectory', relativeTargetDir: 'deployed-service-versions'],
          [$class: 'CleanCheckout'],
        ],
        doGenerateSubmoduleConfigurations: false,
        submoduleCfg: [],
      ],
    )

    checkout(
      poll: false,
      scm: [
        $class: 'GitSCM',
        userRemoteConfigs: [[
          url: 'git@8xxxxxxxxr/images-reporting.git',
          credentialsId: 'xxxxx',
        ]],
        branches: [[name: '*/master']],
        extensions: [
          [$class: 'RelativeTargetDirectory', relativeTargetDir: 'images-reporting'],
          // prune everything in workspace
          [$class: 'CleanCheckout'],
          // avoid detached head. it calculates a local branch derived from the clone (mater in this case)
          [$class: 'LocalBranch'],
        ],
        doGenerateSubmoduleConfigurations: false,
        submoduleCfg: [],
      ],
    )

does poll and trigger on the second repo.

Started on Feb 17, 2017 11:27:00 AM
Using strategy: Default
[poll] Last Built Revision: Revision da056b8e354ad819942980d620f35751b52fad6a (refs/remotes/origin/master)
 > git ls-remote -h git@xxxxxxxx/deployed-service-versions.git # timeout=10
Found 1 remote heads on git@xxxxxxxxxxxxx/deployed-service-versions.git
[poll] Latest remote head revision on refs/heads/master is: da056b8e354ad819942980d620f35751b52fad6a - already built by 202
Using strategy: Default
[poll] Last Built Revision: Revision 724e92bee2268fe431d86239d97ce04ed673a047 (refs/remotes/origin/master)
using GIT_SSH to set credentials gitlab
 > git ls-remote -h git@xxxxxxxx/images-reporting.git # timeout=10
Found 1 remote heads on git@xxxxxx/-images-reporting.git
[poll] Latest remote head revision on refs/heads/master is: e9cfddb95d27a46e3048d12e0a83fedd9a3dc2ae
Done. Took 1.6 sec
Changes found

so, how can I ignore changes in `/images-reporting.git` but build on changes in the the `deployed-service-versions.git' repo?

me@ehaselwanter.com (JIRA)

unread,
Feb 17, 2017, 6:44:02 AM2/17/17
to jenkinsc...@googlegroups.com
Edmund Haselwanter edited a comment on Bug JENKINS-38508
same here.


{code:java}
{code}

does poll and trigger on the
second repo `images-reporting . git` repo, where `poll: false` is set

{code:java}

Started on Feb 17, 2017 11:27:00 AM
Using strategy: Default
[poll] Last Built Revision: Revision da056b8e354ad819942980d620f35751b52fad6a (refs/remotes/origin/master)
> git ls-remote -h git@xxxxxxxx/deployed-service-versions.git # timeout=10
Found 1 remote heads on git@xxxxxxxxxxxxx/deployed-service-versions.git
[poll] Latest remote head revision on refs/heads/master is: da056b8e354ad819942980d620f35751b52fad6a - already built by 202
Using strategy: Default
[poll] Last Built Revision: Revision 724e92bee2268fe431d86239d97ce04ed673a047 (refs/remotes/origin/master)
using GIT_SSH to set credentials gitlab
> git ls-remote -h git@xxxxxxxx/images-reporting.git # timeout=10
Found 1 remote heads on git@xxxxxx/-images-reporting.git
[poll] Latest remote head revision on refs/heads/master is: e9cfddb95d27a46e3048d12e0a83fedd9a3dc2ae
Done. Took 1.6 sec
Changes found
{code}


so, how can I ignore changes in `/images-reporting.git` but build on changes in the the `deployed-service-versions.git' repo?

ansgar.binninger@ars.de (JIRA)

unread,
Feb 21, 2017, 9:39:03 AM2/21/17
to jenkinsc...@googlegroups.com
Ansgar B edited a comment on Bug JENKINS-38508
I have here a small Explanation on StackOverflow with the same/similar case. Maybe it could help you to understand what the problem with the polling is.

[http://stackoverflow.com/questions/40017034/jenkins-pipeline-poll-scm-with-different-repo-for-jenkinsfile-and-application-re]

I try to summarize the problem we have at our company.

We have two repositories. One for the configuration of Jenkinsfiles (config-repo) and on for our Development (dev-repo) , which is included in the Jenkinsfile .
In Jenkins we have 3 Jobs for deployment of the dev-repo. One for dev branch, one for
hotfixe hotfix branch and one for release branch. --> Jenkinsfiles are located in the config-repo. the git step in the Jenkinsfile check out the dev-repo.

If i check new code into the config-repo, the builds aren't triggered, but if we check new code into dev-repo after a checkin/change in the config-repo all jobs configured with the config-repo and using the dev-repo starts a build.

The Jobs should never start a build after checkins into config-repo and only starts a build, if new code is checked into their specific branch at the dev-repo .

me@ehaselwanter.com (JIRA)

unread,
Mar 1, 2017, 7:40:02 AM3/1/17
to jenkinsc...@googlegroups.com
Edmund Haselwanter edited a comment on Bug JENKINS-38508
Update:


{code:java}
          // poll false does not count
          [$class: 'DisableRemotePoll'],
          [$class: 'PathRestriction', excludedRegions: '', includedRegions: 'foo/.*']
{code}

works as a workaround

------ old report -----

does poll and trigger on the `images-reporting.git` repo, where `poll: false` is set


{code:java}
Started on Feb 17, 2017 11:27:00 AM
Using strategy: Default
[poll] Last Built Revision: Revision da056b8e354ad819942980d620f35751b52fad6a (refs/remotes/origin/master)
> git ls-remote -h git@xxxxxxxx/deployed-service-versions.git # timeout=10
Found 1 remote heads on git@xxxxxxxxxxxxx/deployed-service-versions.git
[poll] Latest remote head revision on refs/heads/master is: da056b8e354ad819942980d620f35751b52fad6a - already built by 202
Using strategy: Default
[poll] Last Built Revision: Revision 724e92bee2268fe431d86239d97ce04ed673a047 (refs/remotes/origin/master)
using GIT_SSH to set credentials gitlab
> git ls-remote -h git@xxxxxxxx/images-reporting.git # timeout=10
Found 1 remote heads on git@xxxxxx/-images-reporting.git
[poll] Latest remote head revision on refs/heads/master is: e9cfddb95d27a46e3048d12e0a83fedd9a3dc2ae
Done. Took 1.6 sec
Changes found
{code}

so, how can I ignore changes in `/images-reporting.git` but build on changes in the the `deployed-service-versions.git' repo?

me@ehaselwanter.com (JIRA)

unread,
Mar 1, 2017, 7:40:03 AM3/1/17
to jenkinsc...@googlegroups.com
Edmund Haselwanter edited a comment on Bug JENKINS-38508
Update:


{code:java}
          // poll false does not count
          [$class: 'DisableRemotePoll'],
          [$class: 'PathRestriction', excludedRegions: '', includedRegions: 'foo/.*']
{code}

works as a workaround

daveorders@thebarnums.com (JIRA)

unread,
Mar 13, 2017, 5:33:04 PM3/13/17
to jenkinsc...@googlegroups.com
D B commented on Bug JENKINS-38508

Edmund Haselwanter, Could you explain a bit how to use your workaround?  I'm not sure where to put DisableRemotePoll or PathRestriction.  I tried putting it under the extensions property of checkout scm but it's still polling the secondary repo.

This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

daveorders@thebarnums.com (JIRA)

unread,
Mar 14, 2017, 10:38:04 AM3/14/17
to jenkinsc...@googlegroups.com
D B edited a comment on Bug JENKINS-38508
[~ehaselwanter], Could you explain a bit how to use your workaround?  I'm not sure where to put DisableRemotePoll or PathRestriction.  I tried putting it under the extensions property of checkout scm but it's still polling the secondary repo.

Update: You add them between the extensions: [] brackets.

aaling@ea.com (JIRA)

unread,
Jan 10, 2019, 7:29:03 PM1/10/19
to jenkinsc...@googlegroups.com

I hit this issue as well. Setting changelog to false and restarting Jenkins seems to bypass the issue.

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

nddeshmukh16@gmail.com (JIRA)

unread,
Mar 18, 2019, 12:43:09 PM3/18/19
to jenkinsc...@googlegroups.com

@Edmund Haselwanter ,  Thanks a lot, you saved me ..

 Below workaround worked for me 

extensions: [[$class: 'DisableRemotePoll']]
 def scmVars1 = checkout([def scmVars1 = checkout([ $class : 'GitSCM', branches:  [[name: '*/' + "${BRANCH_PARAM}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'DisableRemotePoll']], submoduleCfg : [], userRemoteConfigs: [[url: 'https://nadeshmu:Welco...@github.com/andeshmukh04/framework.git']] ])

nddeshmukh16@gmail.com (JIRA)

unread,
Mar 18, 2019, 12:51:04 PM3/18/19
to jenkinsc...@googlegroups.com
Nandlal Deshmukh edited a comment on Bug JENKINS-38508
@[~ehaselwanter] ,  Thanks a lot, you saved me ..


 Below workaround worked for me 
{code:java}
extensions: [[$class: 'DisableRemotePoll']]
{code}
{code:java}
def scmVars1 = checkout([def scmVars1 = checkout([ $class : 'GitSCM', branches:  [[name: '*/' + "${BRANCH_PARAM}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'DisableRemotePoll']], submoduleCfg : [], userRemoteConfigs: [[url: 'https://
nadeshmu:Welcome013@ github.com/ andeshmukh04 zbcdeshmukhxys /framework.git']] ])
{code}

igor.fraa@gmail.com (JIRA)

unread,
Mar 2, 2020, 10:02:04 AM3/2/20
to jenkinsc...@googlegroups.com

According to Git plugin source 
[$class: 'DisableRemotePoll']
is not related to disabling polling. It is for repositories with 'ls-remote' disabled and acts as an alias for requiresWorkspaceForPolling parameter. 

the only workaround to disable polling is to set 

[$class: 'PathRestriction', excludedRegions: '', includedRegions: 'no/such/path/exists']
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages