jenkinsci/github-checks-plugin

Plugin not publishing completed status checks back to the correct commit under rare cases

Opened this issue · 0 comments

Jenkins and plugins versions report

Environment
Jenkins: 2.447
OS: Linux - 5.14.0-362.18.1.el9_3.0.1.x86_64
Java: 17.0.10 - Red Hat, Inc. (OpenJDK 64-Bit Server VM)
---
Office-365-Connector:4.21.0
analysis-model-api:12.1.0
ansicolor:1.0.4
ant:497.v94e7d9fffa_b_9
antisamy-markup-formatter:162.v0e6ec0fcfcf6
apache-httpcomponents-client-4-api:4.5.14-208.v438351942757
authentication-tokens:1.53.v1c90fd9191a_b_
basic-branch-build-strategies:81.v05e333931c7d
blueocean:1.27.11
blueocean-bitbucket-pipeline:1.27.11
blueocean-commons:1.27.11
blueocean-config:1.27.11
blueocean-core-js:1.27.11
blueocean-dashboard:1.27.11
blueocean-display-url:2.4.2
blueocean-events:1.27.11
blueocean-git-pipeline:1.27.11
blueocean-github-pipeline:1.27.11
blueocean-i18n:1.27.11
blueocean-jira:1.27.11
blueocean-jwt:1.27.11
blueocean-personalization:1.27.11
blueocean-pipeline-api-impl:1.27.11
blueocean-pipeline-editor:1.27.11
blueocean-pipeline-scm-api:1.27.11
blueocean-rest:1.27.11
blueocean-rest-impl:1.27.11
blueocean-web:1.27.11
bootstrap5-api:5.3.2-4
bouncycastle-api:2.30.1.77-225.v26ea_c9455fd9
branch-api:2.1152.v6f101e97dd77
build-monitor-plugin:1.14-860.vd06ef2568b_3f
build-timeout:1.32
build-token-root:151.va_e52fe3215fc
caffeine-api:3.1.8-133.v17b_1ff2e0599
checks-api:2.0.2
cloudbees-bitbucket-branch-source:877.vb_b_d5243f6794
cloudbees-folder:6.928.v7c780211d66e
command-launcher:107.v773860566e2e
commons-lang3-api:3.13.0-62.v7d18e55f51e2
commons-text-api:1.11.0-95.v22a_d30ee5d36
config-file-provider:968.ve1ca_eb_913f8c
credentials:1337.v60b_d7b_c7b_c9f
credentials-binding:657.v2b_19db_7d6e6d
cucumber-reports:5.8.1
dashboard-view:2.508.va_74654f026d1
data-tables-api:1.13.8-4
display-url-api:2.200.vb_9327d658781
docker-commons:439.va_3cb_0a_6a_fb_29
docker-workflow:572.v950f58993843
durable-task:550.v0930093c4b_a_6
echarts-api:5.4.3-4
email-ext:2.104
favorite:2.208.v91d65b_7792a_c
font-awesome-api:6.5.1-3
forensics-api:2.4.0
gatling:1.3.0
git:5.2.1
git-client:4.6.0
git-forensics:2.1.0
git-push:34.vd474e0fe7b_ec
github:1.38.0
github-api:1.318-461.v7a_c09c9fa_d63
github-branch-source:1772.va_69eda_d018d4
github-checks:554.vb_ee03a_000f65
gitlab-api:5.3.0-91.v1f9a_fda_d654f
gitlab-branch-source:702.v7dde70ed1522
gitlab-plugin:1.8.0
google-compute-engine:4.562.v5ed247b_e6b_42
google-kubernetes-engine:0.999999-SNAPSHOT (private-4a6e3b03-vs)
google-metadata-plugin:0.5
google-oauth-plugin:1.330.vf5e86021cb_ec
google-storage-plugin:1.360.v6ca_38618b_41f
gson-api:2.10.1-15.v0d99f670e0a_7
h2-api:11.1.4.199-12.v9f4244395f7a_
handy-uri-templates-2-api:2.1.8-30.v7e777411b_148
htmlpublisher:1.32
http_request:1.18
instance-identity:185.v303dc7c645f9
ionicons-api:56.v1b_1c8c49374e
jackson2-api:2.16.1-373.ve709c6871598
jakarta-activation-api:2.0.1-3
jakarta-mail-api:2.0.1-3
javadoc:243.vb_b_503b_b_45537
javax-activation-api:1.2.0-6
javax-mail-api:1.6.2-9
jaxb:2.3.9-1
jenkins-design-language:1.27.11
jersey2-api:2.41-133.va_03323b_a_1396
jira:3.12
jjwt-api:0.11.5-77.v646c772fddb_0
joda-time-api:2.12.7-29.v5a_b_e3a_82269a_
jquery3-api:3.7.1-2
jsch:0.2.16-86.v42e010d9484b_
json-api:20240205-27.va_007549e895c
json-path-api:2.9.0-33.v2527142f2e1d
junit:1259.v65ffcef24a_88
junit-attachments:205.vc0677977deb_0
kubernetes:4186.v1d804571d5d4
kubernetes-cli:1.12.1
kubernetes-client-api:6.10.0-240.v57880ce8b_0b_2
kubernetes-credentials:0.11
ldap:711.vb_d1a_491714dc
mailer:463.vedf8358e006b_
matrix-auth:3.2.1
matrix-project:822.824.v14451b_c0fd42
maven-info:0.3.1
maven-plugin:3.23
metrics:4.2.21-449.v6960d7c54c69
mina-sshd-api-common:2.12.0-90.v9f7fb_9fa_3d3b_
mina-sshd-api-core:2.12.0-90.v9f7fb_9fa_3d3b_
oauth-credentials:0.646.v02b_66dc03d2e
okhttp-api:4.11.0-172.vda_da_1feeb_c6e
pam-auth:1.10
pipeline-build-step:540.vb_e8849e1a_b_d8
pipeline-github:2.8-159.09e4403bc62f
pipeline-github-lib:42.v0739460cda_c4
pipeline-githubnotify-step:49.vf37bf92d2bc8
pipeline-graph-analysis:216.vfd8b_ece330ca_
pipeline-graph-view:225.v87c53b_9237dd
pipeline-groovy-lib:704.vc58b_8890a_384
pipeline-input-step:491.vb_07d21da_1a_fb_
pipeline-maven:1376.v18876d10ce9c
pipeline-maven-api:1376.v18876d10ce9c
pipeline-milestone-step:111.v449306f708b_7
pipeline-model-api:2.2175.v76a_fff0a_2618
pipeline-model-definition:2.2175.v76a_fff0a_2618
pipeline-model-extensions:2.2175.v76a_fff0a_2618
pipeline-npm:204.v4dc4c2202625
pipeline-rest-api:2.34
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2175.v76a_fff0a_2618
pipeline-stage-view:2.34
pipeline-utility-steps:2.16.2
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:4.1.0
prism-api:1.29.0-13
pubsub-light:1.18
remote-file:1.24
resource-disposer:0.23
scm-api:683.vb_16722fb_b_80b_
script-security:1326.vdb_c154de8669
snakeyaml-api:2.2-111.vc6598e30cc65
snyk-security-scanner:4.0.2
sse-gateway:1.26
ssh-agent:346.vda_a_c4f2c8e50
ssh-credentials:308.ve4497b_ccd8f4
ssh-slaves:2.948.vb_8050d697fec
ssh-steps:2.0.68.va_d21a_12a_6476
sshd:3.322.v159e91f6a_550
structs:337.v1b_04ea_4df7c8
timestamper:1.26
token-macro:400.v35420b_922dcb_
trilead-api:2.133.vfb_8a_7b_9c5dd1
uno-choice:2.8.1
variant:60.v7290fc0eb_b_cd
warnings-ng:11.1.0
workflow-aggregator:596.v8c21c963d92d
workflow-api:1291.v51fd2a_625da_7
workflow-basic-steps:1042.ve7b_140c4a_e0c
workflow-cps:3880.vb_ef4b_5cfd270
workflow-durable-task-step:1331.vc8c2fed35334
workflow-job:1400.v7fd111b_ec82f
workflow-multibranch:783.va_6eb_ef636fb_d
workflow-scm-step:415.v434365564324
workflow-step-api:657.v03b_e8115821b_
workflow-support:865.v43e78cc44e0d
ws-cleanup:0.45

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

Rocky Linux 9.3

Reproduction steps

Let's say I have a long running Jenkins job which for particular reasons is configured to not run in parallel:

pipeline {
    agent any
    options {
        disableConcurrentBuilds()
    }
    stages {
        stage('Long build') {
            steps {
                sh "sleep 100000"
            }
        }
    }
}

GitHub is integrated with Jenkins via standard GitHub App and Jenkins is receiving webhooks on every commit to the master branch. Jenkins is configured to automatically build the job after every commit.
Under normal circumstances this works just fine:

image

However if I do the following, status checks on some commit are not marked as complete.

  1. Push one commit to sample repository (doesn't matter directly to master or via PR).
  2. While Jenkins jobs is building, do a second commit push. Observe yellow "Queued" icon in the GitHub UI near the second commit. Also observe new waiting job in the Jenkins UI.
  3. Do a third commit push. Now GitHub UI has two commits with yellow "Queued" icon. Jenkins on the other hand has just one waiting job.
  4. When a job associated with first commit finishes the second Jenkins job starts.
  5. When a second Jenkins job finishes only the status of the first commit turns into "Completed" green icon.

image

Expected Results

I would expect that status checks on all commits are marked as completed if Jenkins jobs associated with those commits are successfull.

Actual Results

Some status checks are not marked as completed.

Anything else?

I suspect the real problem here is that status on a commit is marked as "Queued" by the GitHub when it sends a webhook to Jenkins. However, "in_progress" and "completed" is marked back by the GitHub Checks plugin. Jenkins also queues the job, but never creates a third job matching a third commit if new webhook is received. The only job which finishes never takes into account that previous job and new job has a 2 commit difference now.

Therefore, I'm not 100% sure if that's a limitation of Jenkins Multibranch pipeline, the limitation of how jobs are queued in Jenkins core, or just GitHub Checks plugin bug.

Are you interested in contributing a fix?

No response