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

git polling succeeds even when origin/master has nothing new

    Details

    • Type: Bug
    • Status: In Progress (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: git-plugin
    • Labels:
      None
    • Environment:
      Git Plugin 3.3.2
      Jenkins 2.60.1
    • Similar Issues:

      Description

      I have a repository which is setup to perform git polling, and it always triggers, suggesting there are changes, even though there are not.

      In this case, the job has multiple checkouts using a pipeline, but I think it would only happen in the case of a single checkout as well.

      Specifically, the branch name is master, and it checks first all the "remote/branch" combinations, (in this case, "origin/master") and then fails to find anything new (as origin/master was already built). Then, it checks the branch name on its own, thinking that maybe it's a tag or some other ref.

      This results in reporting a separate commit (likely whatever master happens to be at when the polling was created), and thus reports a new commit to build. This causes the build to trigger every polling timeout, even though there aren't any real new changes.

      Here's a subset of the actual output with repository names and paths redacted. I have the VERBOSE logging enabled for more information.

      Started on Apr 3, 2018 4:01:00 PM
      Using strategy: Default
      [poll] Last Built Revision: Revision 72c4cea985bb5ff14813d27dac94f34887cbd841 (refs/remotes/origin/master)
      using GIT_SSH to set credentials 
       > git ls-remote -h <groovyLibURL> # timeout=10
      Found 1 remote heads on <groovyLibURL>
      [poll] Latest remote head revision on refs/heads/master is: 72c4cea985bb5ff14813d27dac94f34887cbd841 - already built by 1738
      Using strategy: Default
      [poll] Last Built Revision: Revision cc24044526e9d460c74a59fcdeb12e43a446cb7d (origin/master)
       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repositories
       > git config remote.origin.url <mainRepositoryURL> # timeout=10
      Fetching upstream changes from <mainRepositoryURL>
       > git --version # timeout=10
      using GIT_SSH to set credentials 
       > git fetch --no-tags --progress <mainRepositoryURL> +refs/heads/*:refs/remotes/origin/*
      Polling for changes in
      getCandidateRevisions(true,master,,,hudson.plugins.git.util.BuildData@3fcd3164[scmName=<mainRepositoryName>,remoteUrls=[<mainRepositoryURL>],buildsByBranchName={origin/master=Build #1738 of Revision cc24044526e9d460c74a59fcdeb12e43a446cb7d (origin/master)},lastBuild=Build #1738 of Revision cc24044526e9d460c74a59fcdeb12e43a446cb7d (origin/master)]) considering branches to build
      Qualifying master as a branch in repository origin -> origin/master
       > git rev-parse origin/master^{commit} # timeout=10
      rev-parse origin/master -> AnyObjectId[cc24044526e9d460c74a59fcdeb12e43a446cb7d]
      AnyObjectId[cc24044526e9d460c74a59fcdeb12e43a446cb7d] has already been built
       > git rev-parse master^{commit} # timeout=10
      Failed to rev-parse: master
      Using strategy: Default
      [poll] Last Built Revision: Revision d24e49e865522042434be7b1a46f592aae2608dc (origin/master)
       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repositories
       > git config remote.origin.url <firstRepositoryURL> # timeout=10
      Fetching upstream changes from <firstRepositoryURL>
       > git --version # timeout=10
      using GIT_SSH to set credentials 
       > git fetch --no-tags --progress <firstRepositoryURL> +refs/heads/*:refs/remotes/origin/*
      Polling for changes in
      getCandidateRevisions(true,master,,,hudson.plugins.git.util.BuildData@857d3e89[scmName=<firstRepositoryName>,remoteUrls=[<firstRepositoryURL>],buildsByBranchName={origin/master=Build #1738 of Revision d24e49e865522042434be7b1a46f592aae2608dc (origin/master)},lastBuild=Build #1738 of Revision d24e49e865522042434be7b1a46f592aae2608dc (origin/master)]) considering branches to build
      Qualifying master as a branch in repository origin -> origin/master
       > git rev-parse origin/master^{commit} # timeout=10
      rev-parse origin/master -> AnyObjectId[d24e49e865522042434be7b1a46f592aae2608dc]
      AnyObjectId[d24e49e865522042434be7b1a46f592aae2608dc] has already been built
       > git rev-parse master^{commit} # timeout=10
      rev-parse master -> AnyObjectId[d24e49e865522042434be7b1a46f592aae2608dc]
      AnyObjectId[d24e49e865522042434be7b1a46f592aae2608dc] has already been built
      Using strategy: Default
      [poll] Last Built Revision: Revision 93a6d3510777096a6fbd7f16ac22c28ef4bd872e (origin/master)
       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repositories
       > git config remote.origin.url <secondRepositoryURL> # timeout=10
      Fetching upstream changes from <secondRepositoryURL>
       > git --version # timeout=10
      using GIT_SSH to set credentials 
       > git fetch --no-tags --progress <secondRepositoryURL> +refs/heads/*:refs/remotes/origin/*
      Polling for changes in
      getCandidateRevisions(true,master,,,hudson.plugins.git.util.BuildData@2e191547[scmName=<secondRepositoryName>,remoteUrls=[<secondRepositoryURL>],buildsByBranchName={origin/master=Build #1738 of Revision 93a6d3510777096a6fbd7f16ac22c28ef4bd872e (origin/master)},lastBuild=Build #1738 of Revision 93a6d3510777096a6fbd7f16ac22c28ef4bd872e (origin/master)]) considering branches to build
      Qualifying master as a branch in repository origin -> origin/master
       > git rev-parse origin/master^{commit} # timeout=10
      rev-parse origin/master -> AnyObjectId[93a6d3510777096a6fbd7f16ac22c28ef4bd872e]
      AnyObjectId[93a6d3510777096a6fbd7f16ac22c28ef4bd872e] has already been built
       > git rev-parse master^{commit} # timeout=10
      rev-parse master -> AnyObjectId[4bf94e5146026ba4e3bebef3b2ebf8a795d0d0f8]
      Found a new commit AnyObjectId[4bf94e5146026ba4e3bebef3b2ebf8a795d0d0f8] to be built on master
      {0} seems to be a non-branch reference (tag?)
       > git log --full-history --no-abbrev --format=raw -M -m 93a6d3510777096a6fbd7f16ac22c28ef4bd872e..4bf94e5146026ba4e3bebef3b2ebf8a795d0d0f8 # timeout=10
      Using strategy: Default
      [poll] Last Built Revision: Revision a4db49e3433ef3304c7956e81369c2ed5fa69b5d (origin/master)
       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repositories
       > git config remote.origin.url <thirdRepositoryURL> # timeout=10
      Fetching upstream changes from <thirdRepositoryURL>
       > git --version # timeout=10
      using GIT_SSH to set credentials 
       > git fetch --no-tags --progress <thirdRepositoryURL> +refs/heads/*:refs/remotes/origin/*
      Polling for changes in
      getCandidateRevisions(true,master,,,hudson.plugins.git.util.BuildData@49f3b5e7[scmName=<thirdRepositoryName>,remoteUrls=[<thirdRepositoryURL>],buildsByBranchName={origin/master=Build #1738 of Revision a4db49e3433ef3304c7956e81369c2ed5fa69b5d (origin/master)},lastBuild=Build #1738 of Revision a4db49e3433ef3304c7956e81369c2ed5fa69b5d (origin/master)]) considering branches to build
      Qualifying master as a branch in repository origin -> origin/master
       > git rev-parse origin/master^{commit} # timeout=10
      rev-parse origin/master -> AnyObjectId[a4db49e3433ef3304c7956e81369c2ed5fa69b5d]
      AnyObjectId[a4db49e3433ef3304c7956e81369c2ed5fa69b5d] has already been built
       > git rev-parse master^{commit} # timeout=10
      rev-parse master -> AnyObjectId[00f059f63e272c44fb3f754be4e2f4a1b474c416]
      Found a new commit AnyObjectId[00f059f63e272c44fb3f754be4e2f4a1b474c416] to be built on master
      {0} seems to be a non-branch reference (tag?)
       > git log --full-history --no-abbrev --format=raw -M -m a4db49e3433ef3304c7956e81369c2ed5fa69b5d..00f059f63e272c44fb3f754be4e2f4a1b474c416 # timeout=10
      Using strategy: Default
      [poll] Last Built Revision: Revision 06188df26697ef38293a8533ce601934762c7d6c (origin/master)
       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repositories
       > git config remote.origin.url <fourthRepositoryURL> # timeout=10
      Fetching upstream changes from <fourthRepositoryURL>
       > git --version # timeout=10
      using GIT_SSH to set credentials 
       > git fetch --no-tags --progress <fourthRepositoryURL> +refs/heads/*:refs/remotes/origin/*
      Polling for changes in
      getCandidateRevisions(true,master,,,hudson.plugins.git.util.BuildData@dff532d1[scmName=<fourthRepositoryName>,remoteUrls=[<fourthRepositoryURL>],buildsByBranchName={origin/master=Build #1738 of Revision 06188df26697ef38293a8533ce601934762c7d6c (origin/master)},lastBuild=Build #1738 of Revision 06188df26697ef38293a8533ce601934762c7d6c (origin/master)]) considering branches to build
      Qualifying master as a branch in repository origin -> origin/master
       > git rev-parse origin/master^{commit} # timeout=10
      rev-parse origin/master -> AnyObjectId[06188df26697ef38293a8533ce601934762c7d6c]
      AnyObjectId[06188df26697ef38293a8533ce601934762c7d6c] has already been built
       > git rev-parse master^{commit} # timeout=10
      Failed to rev-parse: master
      Done. Took 6.5 sec
      Changes found
      

      I am highly suspect that the relevant commit related to why this breaks is:

      c7dae80b85c1 ("JENKINS-21952 Resolve tags with slashes", 2014-02-27)

      I believe what is happening is that the "remote/branch" output is failing to find any new changes, so we fall back to attempting to resolve the name like a tag, but it so happens that the polling setup actually does end up with the branch checked out, and it results in us finding the local master name and reporting it.

      I don't really know how to resolve this yet.

        Attachments

          Issue Links

            Activity

            Hide
            padamstx Phil Adams added a comment -

            Jacob, thanks for the info... it turns out that I did in fact have the "author in change log" option selected, and that was why workspace polling was being used.   By disabling that option, the plugin started doing remote polling.

            Show
            padamstx Phil Adams added a comment - Jacob, thanks for the info... it turns out that I did in fact have the "author in change log" option selected, and that was why workspace polling was being used.   By disabling that option, the plugin started doing remote polling.
            Hide
            jekeller Jacob Keller added a comment -

            I submitted a pull request https://github.com/jenkinsci/git-plugin/pull/583 which should remove that restriction (as far as I can tell, it was inadvertently added and there's no reason that the extension "author in change log" depends on the workspace polling.

            Show
            jekeller Jacob Keller added a comment - I submitted a pull request https://github.com/jenkinsci/git-plugin/pull/583 which should remove that restriction (as far as I can tell, it was inadvertently added and there's no reason that the extension "author in change log" depends on the workspace polling.
            Hide
            jekeller Jacob Keller added a comment -

            I believe I fixed this with the following pull request: https://github.com/jenkinsci/git-plugin/pull/579

            Show
            jekeller Jacob Keller added a comment - I believe I fixed this with the following pull request: https://github.com/jenkinsci/git-plugin/pull/579
            Hide
            markewaite Mark Waite added a comment -

            I've been evaluating this pull request today. Evaluation is not complete, but it is looking good. I'd like to include this in the 4.0.0-beta1 release. However, I first need to merge several other changes (the require-jdk-8 PR and a few others that I've already evaluated).

            I need some help Raul Arabaolaza to understand the test failures on the pull request. I'll connect with him early next week for further discussion.

            Show
            markewaite Mark Waite added a comment - I've been evaluating this pull request today. Evaluation is not complete, but it is looking good. I'd like to include this in the 4.0.0-beta1 release. However, I first need to merge several other changes (the require-jdk-8 PR and a few others that I've already evaluated). I need some help Raul Arabaolaza to understand the test failures on the pull request. I'll connect with him early next week for further discussion.
            Hide
            jekeller Jacob Keller added a comment -

            I've had this pull request running as well in my test instance that I setup to test the thousands of branches case with the build details pull request as well, so far I haven't found any issues either.

            I'm curious what the ATH thing is as well. Hopefully we can get to the bottom of that one.

            Show
            jekeller Jacob Keller added a comment - I've had this pull request running as well in my test instance that I setup to test the thousands of branches case with the build details pull request as well, so far I haven't found any issues either. I'm curious what the ATH thing is as well. Hopefully we can get to the bottom of that one.

              People

              • Assignee:
                markewaite Mark Waite
                Reporter:
                jekeller Jacob Keller
              • Votes:
                2 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: