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

Git Polling Keeps Detecting Changes When Variables in refspec

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • None

      I have a job where the git refspec and branch are set to +refs/heads/${branch}:refs/remotes/origin/${branch} and the branch is set to ${branch}.

      With that configuration, the SCM polling keeps triggering new builds from the same change.

      If I replace the variables with their values, the SCM polling works correctly.

          [JENKINS-22009] Git Polling Keeps Detecting Changes When Variables in refspec

          Christian Goetze created issue -

          aaronlab added a comment -

          I agree with this bug .... older versions of the Git plugin used to properly resolve variables in the "branches to build" field in both parameterized builds and polling. Now, it seems that polling does not resolve variables when issuing the ls-remote command. Can someone look into this – it seems like a trivial thing to fix.

          Thanks.

          aaronlab added a comment - I agree with this bug .... older versions of the Git plugin used to properly resolve variables in the "branches to build" field in both parameterized builds and polling. Now, it seems that polling does not resolve variables when issuing the ls-remote command. Can someone look into this – it seems like a trivial thing to fix. Thanks.

          I can confirm this bug. With Jenkins 1.572, git client plugin 1.9.2 and git plugin 2.2.2 the polling module does not resolve our "$branch" variable, set in the parametrized build configuration:

          Started on Jul 17, 2014 10:50:00 AM
          Using strategy: Default
          [poll] Last Built Revision: Revision 2d1a169f855f69312b4b47819283063ea15c1448 (origin/master)
          > git ls-remote -h git://github.com/gem/oq-nrmllib.git $branch
          Done. Took 0.54 sec
          No changes

          Daniele Vigano added a comment - I can confirm this bug. With Jenkins 1.572, git client plugin 1.9.2 and git plugin 2.2.2 the polling module does not resolve our "$branch" variable, set in the parametrized build configuration: Started on Jul 17, 2014 10:50:00 AM Using strategy: Default [poll] Last Built Revision: Revision 2d1a169f855f69312b4b47819283063ea15c1448 (origin/master) > git ls-remote -h git://github.com/gem/oq-nrmllib.git $branch Done. Took 0.54 sec No changes

          Sean Flanigan added a comment -

          I've hit this bug too, when using parameters in the Branch Specifier field. Git plugin 2.2.2, Git client plugin 1.9.2, Jenkins 1.554.3 LTS.

          You can work around this bug by disabling remote polling for the affected jobs. (I think this is true for most of the git trigger bugs listed here [1].) I have a Jenkins script (for Script Console or Scriptler) which disables remote polling for all jobs [2].

          [1] http://jenkins-ci.361315.n4.nabble.com/git-polling-builds-every-2-minutes-repository-isn-t-changing-why-td4679352.html#a4700637
          [2] http://scriptlerweb.appspot.com/script/show/456001

          Sean Flanigan added a comment - I've hit this bug too, when using parameters in the Branch Specifier field. Git plugin 2.2.2, Git client plugin 1.9.2, Jenkins 1.554.3 LTS. You can work around this bug by disabling remote polling for the affected jobs. (I think this is true for most of the git trigger bugs listed here [1] .) I have a Jenkins script (for Script Console or Scriptler) which disables remote polling for all jobs [2] . [1] http://jenkins-ci.361315.n4.nabble.com/git-polling-builds-every-2-minutes-repository-isn-t-changing-why-td4679352.html#a4700637 [2] http://scriptlerweb.appspot.com/script/show/456001
          Jakob Korherr made changes -
          Link New: This issue is related to JENKINS-21886 [ JENKINS-21886 ]
          Jakob Korherr made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Jakob Korherr added a comment -

          Created pull request on github: https://github.com/jenkinsci/git-plugin/pull/245
          Please merge. Change contains fix and test case.

          Jakob Korherr added a comment - Created pull request on github: https://github.com/jenkinsci/git-plugin/pull/245 Please merge. Change contains fix and test case.

          Code changed in jenkins
          User: Jakob Korherr
          Path:
          src/main/java/hudson/plugins/git/util/GitUtils.java
          src/test/java/hudson/plugins/git/GitSCMTest.java
          http://jenkins-ci.org/commit/git-plugin/027cc051aa87ae0b9b006234a8d53974de42568b
          Log:
          JENKINS-22009 Git Polling Keeps Detecting Changes When Variables in refspec (setup correct environment for polling + test case)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jakob Korherr Path: src/main/java/hudson/plugins/git/util/GitUtils.java src/test/java/hudson/plugins/git/GitSCMTest.java http://jenkins-ci.org/commit/git-plugin/027cc051aa87ae0b9b006234a8d53974de42568b Log: JENKINS-22009 Git Polling Keeps Detecting Changes When Variables in refspec (setup correct environment for polling + test case)

          Code changed in jenkins
          User: Jakob Korherr
          Path:
          src/main/java/hudson/plugins/git/util/GitUtils.java
          http://jenkins-ci.org/commit/git-plugin/f6fd156b4981bcffbb6aa64ee321b41d0db51370
          Log:
          JENKINS-22009 Git Polling Keeps Detecting Changes When Variables in refspec (apply API changes in 2.2.x)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jakob Korherr Path: src/main/java/hudson/plugins/git/util/GitUtils.java http://jenkins-ci.org/commit/git-plugin/f6fd156b4981bcffbb6aa64ee321b41d0db51370 Log: JENKINS-22009 Git Polling Keeps Detecting Changes When Variables in refspec (apply API changes in 2.2.x)

          Code changed in jenkins
          User: Mark Waite
          Path:
          src/main/java/hudson/plugins/git/util/GitUtils.java
          src/test/java/hudson/plugins/git/GitSCMTest.java
          http://jenkins-ci.org/commit/git-plugin/1dc2db5cb67c8c1c8dbd004f1c7966d3e86d4d5c
          Log:
          Merge pull request #250 from jakobk/2.2.x

          fix JENKINS-22009 on 2.2.x branch

          Compare: https://github.com/jenkinsci/git-plugin/compare/63b05764bd0e...1dc2db5cb67c

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/main/java/hudson/plugins/git/util/GitUtils.java src/test/java/hudson/plugins/git/GitSCMTest.java http://jenkins-ci.org/commit/git-plugin/1dc2db5cb67c8c1c8dbd004f1c7966d3e86d4d5c Log: Merge pull request #250 from jakobk/2.2.x fix JENKINS-22009 on 2.2.x branch Compare: https://github.com/jenkinsci/git-plugin/compare/63b05764bd0e...1dc2db5cb67c

            jakobk Jakob Korherr
            cg Christian Goetze
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: