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

Multiple Github webhook deliveries in quick succession result in some builds not being triggered

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • github-plugin
    • None

      To reproduce:

      Part 1: Project setup

      1. Create a new freestyle project.
      2. Check the "Github project" checkbox and enter an HTTPS URL to a Github repo.
      3. In the "Source Code Management" section, select the "Git" radiobutton and enter the SSH URL for the Github repo from step 2, and provide relevant credentials to access it.
      4. In "Build Triggers", check the "GitHub hook trigger for GITScm polling" box.

      Part 2: Triggering builds

      Run the following script in the Github repo you used in part 1:

      #!/usr/bin/env bash

      git checkout -b branch-1
      touch file-1
      git add file-1
      git commit -m 'adding file-1'

      git checkout -b branch-2
      touch file-2
      git add file-2
      git commit -m 'adding file-2'

      git checkout branch-1
      git push origin branch-1

      git checkout branch-2
      git push origin branch-2

       

      This should trigger a build of both branch-1 and branch-2, but only triggers a build of branch-2. Looking at the Jenkins logs, I can see the following:

      2021-08-20 07:49:20.977 UTC 2021-08-20 07:49:20.976+0000 [id=388895] INFO o.j.p.g.w.s.DefaultPushGHEventSubscriber#onEvent: Received PushEvent for https://github.com/my-org/my-repo from 140.82.115.250 → 140.82.115.250 ⇒ https://my-jenkins/github-webhook/
      2021-08-20 07:49:20.978 UTC  2021-08-20 07:49:20.978+0000 [id=388895] INFO o.j.p.g.w.s.DefaultPushGHEventSubscriber$1#run: Poked my-project 
       2021-08-20 07:49:22.131 UTC 2021-08-20 07:49:22.131+0000 [id=10755] INFO c.c.jenkins.GitHubPushTrigger$1#run: SCM changes detected in my-project. Triggering #26 
      2021-08-20 07:49:23.018 UTC  2021-08-20 07:49:23.017+0000 [id=394839] INFO o.j.p.g.w.s.DefaultPushGHEventSubscriber#onEvent: Received PushEvent for https://github.com/my-org/my-repo from 140.82.115.154 → 140.82.115.154 ⇒ https://my-jenkins/github-webhook/ 
       2021-08-20 07:49:23.019 UTC 2021-08-20 07:49:23.018+0000 [id=394839] INFO o.j.p.g.w.s.DefaultPushGHEventSubscriber$1#run: Poked my-project 
      2021-08-20 07:49:24.162 UTC  2021-08-20 07:49:24.162+0000 [id=19470] INFO c.c.jenkins.GitHubPushTrigger$1#run: SCM changes detected in my-project. Triggering #26

      As you can see, two webhooks have been delivered from Github in quick succession for the two branches (I've checked the delivery logs on the Github side to verify this), but it looks like only one build has been triggered. I would have expected two builds to be triggered, one for each branch.

          [JENKINS-66412] Multiple Github webhook deliveries in quick succession result in some builds not being triggered

          andrew zah added a comment -

          It seems we are experiencing this one also. Very annoying bug since it's very intermittent. 

          Our case is following:

          Our repos are configured to automatically delete head branches once PR is merged, so when something gets merged to master webhook sends 2 pushes instantly. One about push to master and one about the removal of branch, Jenkins recieves both of them but sometimes doesn't do anything afterward. 

          andrew zah added a comment - It seems we are experiencing this one also. Very annoying bug since it's very intermittent.  Our case is following: Our repos are configured to automatically delete head branches once PR is merged, so when something gets merged to master webhook sends 2 pushes instantly. One about push to master and one about the removal of branch, Jenkins recieves both of them but sometimes doesn't do anything afterward. 

            lanwen Kirill Merkushev
            alangibson01 Alan Gibson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: