Skip to content

IssueCommentTrigger creates two duplicate builds #134

Description

@briehanlombaard

Jenkins and plugins versions report

Environment
Jenkins: 2.516.1
OS: Linux - 6.6.72+
Java: 21.0.8 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
---
antisamy-markup-formatter:173.v680e3a_b_69ff3
apache-httpcomponents-client-4-api:4.5.14-269.vfa_2321039a_83
apache-httpcomponents-client-5-api:5.5-157.vb_43ef2f6845e
asm-api:9.8-163.vb_2a_96d3f9c3c
authentication-tokens:1.144.v5ff4a_5ec5c33
basic-branch-build-strategies:275.vde2351b_4a_58b_
blueocean:1.27.21
blueocean-autofavorite:1.2.5
blueocean-bitbucket-pipeline:1.27.21
blueocean-commons:1.27.21
blueocean-config:1.27.21
blueocean-core-js:1.27.21
blueocean-dashboard:1.27.21
blueocean-display-url:2.4.4
blueocean-events:1.27.21
blueocean-git-pipeline:1.27.21
blueocean-github-pipeline:1.27.21
blueocean-i18n:1.27.21
blueocean-jwt:1.27.21
blueocean-personalization:1.27.21
blueocean-pipeline-api-impl:1.27.21
blueocean-pipeline-editor:1.27.21
blueocean-pipeline-scm-api:1.27.21
blueocean-rest:1.27.21
blueocean-rest-impl:1.27.21
blueocean-web:1.27.21
bootstrap5-api:5.3.7-2
bouncycastle-api:2.30.1.81-264.v95c79c0e772c
branch-api:2.1244.vf95c81f1641c
caffeine-api:3.2.2-178.v353b_8428ed56
checks-api:373.vfe7645102093
cloudbees-bitbucket-branch-source:936.4.4
cloudbees-folder:6.1037.v4cb_8573b_72a_a_
command-launcher:123.v37cfdc92ef67
commons-lang3-api:3.18.0-98.v3a_674c06072d
commons-text-api:1.14.0-194.v804a_dc3a_1b_d8
config-file-provider:994.v3d4a_5fa_f353a_
configuration-as-code:1985.vdda_32d0c4ea_b_
credentials:1419.v2337d1ceceef
credentials-binding:702.vfe613e537e88
data-tables-api:2.3.2-3
display-url-api:2.217.va_6b_de84cc74b_
docker-commons:457.v0f62a_94f11a_3
docker-workflow:621.va_73f881d9232
durable-task:595.ve87b_f1318d67
echarts-api:6.0.0-1
eddsa-api:0.3.0.1-19.vc432d923e5ee
embeddable-build-status:602.v766a_264519c7
favorite:2.237.v79163ca_8b_892
font-awesome-api:7.0.0-1
git:5.7.0
git-changelog:3.45
git-client:6.3.0
git-server:137.ve0060b_432302
github:1.44.0
github-api:1.321-488.v9b_c0da_9533f8
github-branch-source:1834.v857721ea_74c6
github-oauth:651.v135e939e8b_60
github-pr-comment-build:134.ve7ff0b_719821
github-scm-trait-commit-skip:0.4.0
google-login:109.v022b_cf87b_e5b_
google-oauth-plugin:1.335.ve6de40e2db_18
gson-api:2.13.1-153.vb_3d0c48a_a_b_4a_
handy-uri-templates-2-api:2.1.8-36.v85e4cb_234a_13
htmlpublisher:427
instance-identity:203.v15e81a_1b_7a_38
ionicons-api:94.vcc3065403257
jackson2-api:2.19.2-408.v18248a_324cfe
jakarta-activation-api:2.1.3-2
jakarta-mail-api:2.1.3-2
javax-activation-api:1.2.0-8
javax-mail-api:1.6.2-11
jaxb:2.3.9-133.vb_ec76a_73f706
jdk-tool:83.v417146707a_3d
jenkins-design-language:1.27.21
jjwt-api:0.11.5-120.v0268cf544b_89
job-dsl:1.93
joda-time-api:2.14.0-149.v1c3ce991d1b_9
jquery3-api:3.7.1-583.vda_6ca_102270d
jsch:0.2.16-95.v3eecb_55fa_b_78
json-api:20250517-163.v1c5da_e99c775
json-path-api:2.9.0-178.vca_b_c71881321
junit:1335.v6b_a_a_e18534e1
kubernetes:4358.vcfd9c5a_0a_f51
kubernetes-client-api:7.3.1-256.v788a_0b_787114
kubernetes-credentials:206.vde31a_b_0f71a_c
kubernetes-pipeline-devops-steps:1.6
lockable-resources:1412.v3f305a_fb_a_117
mailer:515.vd788654779b_1
matrix-project:856.v4c352b_3a_b_23e
metrics:4.2.32-481.v75f035fdc894
mina-sshd-api-common:2.15.0-161.vb_200831a_c15b_
mina-sshd-api-core:2.15.0-161.vb_200831a_c15b_
oauth-credentials:0.657.v7d8dd90b_0382
okhttp-api:4.11.0-189.v976fa_d3379d6
pipeline-build-step:571.v08a_fffd4b_0ce
pipeline-github:2.8-162.382498405fdc
pipeline-github-lib:65.v203688e7727e
pipeline-githubnotify-step:49.vf37bf92d2bc8
pipeline-graph-analysis:241.vc3d48fb_b_2582
pipeline-groovy-lib:752.vdddedf804e72
pipeline-input-step:534.v352f0a_e98918
pipeline-milestone-step:138.v78ca_76831a_43
pipeline-model-api:2.2265.v140e610fe9d5
pipeline-model-definition:2.2265.v140e610fe9d5
pipeline-model-extensions:2.2265.v140e610fe9d5
pipeline-multibranch-defaults:2.1
pipeline-rest-api:2.38
pipeline-stage-step:322.vecffa_99f371c
pipeline-stage-tags-metadata:2.2265.v140e610fe9d5
pipeline-stage-view:2.38
plain-credentials:199.v9f8e1f741799
plugin-util-api:6.1154.ved7e7d3035a_5
prism-api:1.30.0-1
pubsub-light:1.19
rebuild:338.va_0a_b_50e29397
resource-disposer:0.25
scm-api:707.v749f968369d4
scm-filter-branch-pr:222.v72301ecb_a_ee7
script-security:1378.vf25626395f49
slack:795.v4b_9705b_e6d47
snakeyaml-api:2.3-125.v4d77857a_b_402
sonar:2.18
sse-gateway:1.28
ssh-agent:386.v36cc0c7582f0
ssh-credentials:361.vb_f6760818e8c
sshd:3.374.v19b_d59ce6610
startup-trigger-plugin:2.9.4
structs:353.v261ea_40a_80fb_
timestamper:1.30
token-macro:477.vd4f0dc3cb_cf1
trilead-api:2.209.v0e69b_c43c245
variant:70.va_d9f17f859e0
workflow-aggregator:608.v67378e9d3db_1
workflow-api:1384.vdc05a_48f535f
workflow-basic-steps:1079.vce64b_a_929c5a_
workflow-cps:4183.v94b_6fd39da_c1
workflow-durable-task-step:1452.v0ee719c104a_7
workflow-job:1540.v295eccc9778f
workflow-multibranch:811.vcd33d074c2a_0
workflow-scm-step:437.v05a_f66b_e5ef8
workflow-step-api:706.v518c5dcb_24c0
workflow-support:976.vb_d9493c2eb_09
ws-cleanup:0.49

What Operating System are you using (both controller, and any agents involved in the problem)?

We use the official Jenkins LTS docker image for the controller on kubernetes.

Reproduction steps

  1. Comment "test this please" on a GitHub PR
  2. Two builds are started
  3. One of the builds is superseded by the other and is marked as NOT_BUILT

Expected Results

We expect a single comment to trigger a single build/job.

Actual Results

We have a multibranch setup with standardised declarative pipelines across all of our repositories and have a configured those as per the documentation by adding the trigger to our pipeline:

pipeline {
    triggers {
        issueCommentTrigger('.*test this please.*')
    }
    ...<redacted>...
}

What we are seeing is that Jenkins is creating two distinct, but duplicate builds when we comment "test this please" on a PR. We are not receiving two events from github so that can be ruled out.

I added a log recorder on org.jenkinsci.plugins.github to get more visibility:

Aug 26, 2025 1:13:40 PM FINE org.jenkinsci.plugins.github.webhook.GHEventHeader$PayloadHandler parse
Header X-GitHub-Event -> issue_comment
Aug 26, 2025 1:13:40 PM FINEST org.jenkinsci.plugins.github.webhook.GHEventPayload$PayloadHandler parse
Payload {"action":"created","issue":{...<redacted>...}}
Aug 26, 2025 1:13:40 PM FINE org.jenkinsci.plugins.pipeline.github.trigger.GitHubEventSubscriber onEvent
Received event: ISSUE_COMMENT

Aug 26, 2025 1:13:40 PM FINE org.jenkinsci.plugins.pipeline.github.trigger.GitHubEventSubscriber commentTriggerMatches
Job: <redacted>/<redacted>/PR-214, IssueComment: GHIssueComment@17acb42a[body=test this please,createdAt=2025-08-26T11:13:38Z,id=3223728074,nodeId=IC_kwDOAwsv9M7AJi_K,updatedAt=2025-08-26T11:13:38Z,url=https://api.github.com/repos/<redacted>/<redacted>/issues/comments/3223728074] matched Pattern: .*test this please.*
Aug 26, 2025 1:13:40 PM INFO org.jenkinsci.plugins.pipeline.github.trigger.GitHubEventSubscriber handleIssueComment
Job: <redacted>/<redacted>/PR-214 triggered by IssueComment: GHIssueComment@17acb42a[body=test this please,createdAt=2025-08-26T11:13:38Z,id=3223728074,nodeId=IC_kwDOAwsv9M7AJi_K,updatedAt=2025-08-26T11:13:38Z,url=https://api.github.com/repos/<redacted>/<redacted>/issues/comments/3223728074]

Aug 26, 2025 1:13:40 PM FINE org.jenkinsci.plugins.pipeline.github.trigger.GitHubEventSubscriber commentTriggerMatches
Job: <redacted>/<redacted>/PR-214, IssueComment: GHIssueComment@17acb42a[body=test this please,createdAt=2025-08-26T11:13:38Z,id=3223728074,nodeId=IC_kwDOAwsv9M7AJi_K,updatedAt=2025-08-26T11:13:38Z,url=https://api.github.com/repos/<redacted>/<redacted>/issues/comments/3223728074] matched Pattern: .*test this please.*
Aug 26, 2025 1:13:40 PM INFO org.jenkinsci.plugins.pipeline.github.trigger.GitHubEventSubscriber handleIssueComment
Job: <redacted>/<redacted>/PR-214 triggered by IssueComment: GHIssueComment@17acb42a[body=test this please,createdAt=2025-08-26T11:13:38Z,id=3223728074,nodeId=IC_kwDOAwsv9M7AJi_K,updatedAt=2025-08-26T11:13:38Z,url=https://api.github.com/repos/<redacted>/<redacted>/issues/comments/3223728074]
  1. We receive a single issue comment event from GitHub as we can see with the Received event: ISSUE_COMMENT line per the code here
  2. We then see two instances of this log line even though we only received one event

Anything else?

No response

Are you interested in contributing a fix?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions