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

Git SCM Polling returns false positives when pipeline branch spec is changed

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:
      CloudBees Jenkins Enterprise 2.73.30.0.1-fixed
      Git Client Plugin 2.7.1
      Git Plugin 3.8.0
      Atlassian Bitbucket v5.11.1
    • Similar Issues:

      Description

      Under certain conditions, the Git SCM polling will return false positives.  It gets into a state where it is consistently comparing hashes from two different branches, which will always trigger a build.  Under some conditions, this can cause a build queue to back up.

      Steps to reproduce:

      1. Jenkins pipeline job, using Jenkinsfile, with branch spec ("Branches to build") set to "*/master"; SCM polling set to some short interval (e.g. 5 minutes)
        Note: This behavior was also observed with the branch spec when using "refs/heads/<branchname>" instead of "*/<branchname>"
      2. Create a new branch
      3. Commit to that branch and push to the server (to establish the branch on the server)
      4. Update the Jenkins job config to point to the new branch
      5. Commit to master and push to the server
      6. Commit to the new branch and push to the server

      The console log of the next build shows that the build itself is pulling from the correct branch (the new branch), but the Git Polling Log shows that the SCM polling is still looking at master.

      On the next poll after that, Jenkins queues another build, even if no changes are pushed to the server.  The Git Polling Log shows that it is comparing the hash of a commit on master to the hash of a commit on the test branch.  This compare will always result in a build being queued.  A sample polling log is shown below:

      Started on Feb 20, 2019 8:04:00 PM
      Using strategy: Default
      [poll] Last Built Revision: Revision b78264e16c8290c779bec8a1ee96236fe123ef67 (refs/remotes/origin/roguebuild)
       > /apps/git_2.9.3/bin/git --version # timeout=10
      using GIT_ASKPASS to set credentials 
       > /apps/git_2.9.3/bin/git ls-remote -h https://mybitbucket.mycompany.com:8443/bitbucket/scm/myproject/service-bus.git # timeout=10
      Found 29 remote heads on https://mybitbucket.mycompany.com:8443/bitbucket/scm/myproject/service-bus.git
      [poll] Latest remote head revision on refs/heads/master is: 6b7a38224cfee3759ed0c45e609a121079af224a
      Done. Took 0.41 sec
      Changes found
      

      The job will continue queueing builds indefinitely at every SCM polling interval.

      Remediating the issue requires disabling the build, cleaning out any unneeded jobs from the queue, and setting the branch spec back to master in the job configuration.

       

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              drosen02 David Rosenfeld
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: