github-plugin icon indicating copy to clipboard operation
github-plugin copied to clipboard

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

Open jenkins-infra-bot opened this issue 4 years ago • 1 comments

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.


Originally reported by alangibson01, imported from: Multiple Github webhook deliveries in quick succession result in some builds not being triggered
  • assignee: lanwen
  • status: Open
  • priority: Major
  • component(s): github-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 2025-12-08
Raw content of original issue

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.

environment
Jenkins version: 2.222.4<br/>
Java version:<br/>
java.runtime.name	OpenJDK Runtime Environment<br/>
java.runtime.version	1.8.0_212-b04<br/>
java.specification.name	Java Platform API Specification<br/>
java.specification.vendor	Oracle Corporation<br/>
java.specification.version	1.8<br/>
java.vendor	IcedTea<br/>
java.vendor.url	<a href="https://icedtea.classpath.org">https://icedtea.classpath.org</a><br/>
java.vendor.url.bug	<a href="https://icedtea.classpath.org/bugzilla">https://icedtea.classpath.org/bugzilla</a><br/>
java.version	1.8.0_212<br/>
java.vm.info	mixed mode<br/>
java.vm.name	OpenJDK 64-Bit Server VM<br/>
java.vm.specification.name	Java Virtual Machine Specification<br/>
java.vm.specification.vendor	Oracle Corporation<br/>
java.vm.specification.version	1.8<br/>
java.vm.vendor	IcedTea<br/>
java.vm.version	25.212-b04<br/>
Plugins:<br/>
Name-Version-Enabled<br/>
ace-editor	1.1	true<br/>
active-directory	2.16.1	true<br/>
analysis-model-api	9.8.0	true<br/>
ansicolor	0.7.5	true<br/>
ant	1.11	true<br/>
antisamy-markup-formatter	2.1	true<br/>
apache-httpcomponents-client-4-api	4.5.13-1.0	true<br/>
authentication-tokens	1.4	true<br/>
badge	1.8	true<br/>
blueocean	1.24.4	true<br/>
blueocean-autofavorite	1.2.4	true<br/>
blueocean-bitbucket-pipeline	1.24.4	true<br/>
blueocean-commons	1.24.4	true<br/>
blueocean-config	1.24.4	true<br/>
blueocean-core-js	1.24.4	true<br/>
blueocean-dashboard	1.24.4	true<br/>
blueocean-display-url	2.4.0	true<br/>
blueocean-events	1.24.4	true<br/>
blueocean-git-pipeline	1.24.4	true<br/>
blueocean-github-pipeline	1.24.4	true<br/>
blueocean-i18n	1.24.4	true<br/>
blueocean-jira	1.24.4	true<br/>
blueocean-jwt	1.24.4	true<br/>
blueocean-personalization	1.24.4	true<br/>
blueocean-pipeline-api-impl	1.24.4	true<br/>
blueocean-pipeline-editor	1.24.4	true<br/>
blueocean-pipeline-scm-api	1.24.4	true<br/>
blueocean-rest	1.24.4	true<br/>
blueocean-rest-impl	1.24.4	true<br/>
blueocean-web	1.24.4	true<br/>
bootstrap4-api	4.6.0-1	true<br/>
bouncycastle-api	2.18	true<br/>
branch-api	2.6.2	true<br/>
build-monitor-plugin	1.12+build.201809061734	true<br/>
built-on-column	1.1	true<br/>
checks-api	1.5.0	true<br/>
cloudbees-bitbucket-branch-source	2.9.7	true<br/>
cloudbees-disk-usage-simple	0.10	true<br/>
cloudbees-folder	6.15	true<br/>
command-launcher	1.5	true<br/>
conditional-buildstep	1.4.1	true<br/>
configuration-as-code	1.36.2	true<br/>
configuration-as-code-groovy	1.1	true<br/>
credentials	2.3.11	true<br/>
credentials-binding	1.24	true<br/>
cucumber-reports	5.5.0	true<br/>
data-tables-api	1.10.23-2	true<br/>
disk-usage	0.28	true<br/>
display-url-api	2.3.4	true<br/>
docker-commons	1.16	true<br/>
docker-workflow	1.26	true<br/>
durable-task	1.35	true<br/>
echarts-api	4.9.0-3	true<br/>
envinject	2.3.0	true<br/>
envinject-api	1.7	true<br/>
extended-read-permission	3.2	true<br/>
external-monitor-job	1.7	true<br/>
favorite	2.3.2	true<br/>
font-awesome-api	5.15.2-1	true<br/>
forensics-api	0.10.1	true<br/>
gatling	1.3.0	true<br/>
ghprb	1.42.2	true<br/>
git	4.4.5	true<br/>
git-client	3.5.1	true<br/>
git-server	1.9	true<br/>
github	1.32.0	true<br/>
github-api	1.117	true<br/>
github-branch-source	2.9.3	true<br/>
gitlab-hook	1.4.2	true<br/>
gitlab-plugin	1.5.13	true<br/>
gradle	1.36	true<br/>
groovy-postbuild	2.5	true<br/>
handlebars	1.1.1	true<br/>
handy-uri-templates-2-api	2.1.8-1.0	true<br/>
hsts-filter-plugin	1.0	true<br/>
htmlpublisher	1.25	true<br/>
icon-shim	2.0.3	true<br/>
jackson2-api	2.11.1	true<br/>
javadoc	1.6	true<br/>
jdk-tool	1.5	true<br/>
jenkins-design-language	1.24.4	true<br/>
jenkins-multijob-plugin	1.36	true<br/>
jira	3.1.1	true<br/>
job-dsl	1.77	true<br/>
jobConfigHistory	2.26	true<br/>
jquery	1.12.4-1	true<br/>
jquery3-api	3.5.1-2	true<br/>
jsch	0.1.55.2	true<br/>
junit	1.37	true<br/>
kubernetes	1.24.1	true<br/>
kubernetes-client-api	4.9.2-2	true<br/>
kubernetes-credentials	0.8.0	true<br/>
ldap	1.25	true<br/>
lockable-resources	2.10	true<br/>
m2release	0.16.2	true<br/>
mailer	1.32.1	true<br/>
matrix-auth	2.5.1	true<br/>
matrix-project	1.18	true<br/>
maven-plugin	3.8	true<br/>
metrics	4.0.2.6	true<br/>
momentjs	1.1.1	true<br/>
multiple-scms	0.6	true<br/>
nodelabelparameter	1.7.2	true<br/>
oic-auth	1.8	true<br/>
okhttp-api	3.14.9	true<br/>
pam-auth	1.6	true<br/>
parameterized-trigger	2.39	true<br/>
performance	3.19	true<br/>
pipeline-build-step	2.13	true<br/>
pipeline-graph-analysis	1.10	true<br/>
pipeline-input-step	2.12	true<br/>
pipeline-milestone-step	1.3.2	true<br/>
pipeline-model-api	1.8.4	true<br/>
pipeline-model-declarative-agent	1.1.1	true<br/>
pipeline-model-definition	1.8.4	true<br/>
pipeline-model-extensions	1.8.4	true<br/>
pipeline-rest-api	2.19	true<br/>
pipeline-stage-step	2.5	true<br/>
pipeline-stage-tags-metadata	1.8.4	true<br/>
pipeline-stage-view	2.19	true<br/>
pipeline-utility-steps	2.6.1	true<br/>
plain-credentials	1.7	true<br/>
plugin-usage-plugin	1.2	true<br/>
plugin-util-api	1.7.1	true<br/>
popper-api	1.16.1-1	true<br/>
postbuild-task	1.9	true<br/>
prometheus	2.0.8	true<br/>
pubsub-light	1.13	true<br/>
purge-build-queue-plugin	1.0	true<br/>
rebuild	1.32	true<br/>
repository-connector	1.2.6	true<br/>
resource-disposer	0.15	true<br/>
role-strategy	2.16	true<br/>
ruby-runtime	0.12	true<br/>
run-condition	1.3	true<br/>
scm-api	2.6.4	true<br/>
script-security	1.76	true<br/>
slack	2.41	true<br/>
snakeyaml-api	1.27.0	true<br/>
sse-gateway	1.24	true<br/>
ssh-agent	1.20	true<br/>
ssh-credentials	1.18.1	true<br/>
ssh-slaves	1.31.3	true<br/>
structs	1.21	true<br/>
text-finder	1.15	true<br/>
timestamper	1.11.8	true<br/>
token-macro	2.12	true<br/>
trilead-api	1.0.13	true<br/>
variant	1.3	true<br/>
view-job-filters	2.2	true<br/>
warnings-ng	8.9.2	true<br/>
windows-slaves	1.6	true<br/>
workflow-aggregator	2.6	true<br/>
workflow-api	2.41	true<br/>
workflow-basic-steps	2.21	true<br/>
workflow-cps	2.88	true<br/>
workflow-cps-global-lib	2.17	true<br/>
workflow-durable-task-step	2.35	true<br/>
workflow-job	2.40	true<br/>
workflow-multibranch	2.22	true<br/>
workflow-scm-step	2.11	true<br/>
workflow-step-api	2.23	true<br/>
workflow-support	3.7	true<br/>
ws-cleanup	0.39	true

jenkins-infra-bot avatar Aug 20 '21 09:08 jenkins-infra-bot

fr33l:
  • Original comment link
  • Raw content of original 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. 

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. 

jenkins-infra-bot avatar Feb 23 '22 10:02 jenkins-infra-bot