jenkinsci / ghprb-plugin

github pull requests builder plugin for Jenkins
https://plugins.jenkins.io/ghprb/
MIT License
498 stars 606 forks source link

Changing the status context (name) in the config while a job is running leaves the old status in pending forever #855

Open mihai-iacov opened 1 year ago

mihai-iacov commented 1 year ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.332.2 OS: Linux - 3.10.0-1160.66.1.el7.x86_64 --- ace-editor:1.1 active-directory:2.25.1 ansicolor:1.0.1 ant:1.13 antisamy-markup-formatter:2.7 apache-httpcomponents-client-4-api:4.5.13-1.0 artifactory:3.16.1 audit-trail:3.10 authentication-tokens:1.4 aws-credentials:191.vcb_f183ce58b_9 aws-java-sdk:1.12.287-357.vf82d85a_6eefd aws-java-sdk-cloudformation:1.12.287-357.vf82d85a_6eefd aws-java-sdk-codebuild:1.12.287-357.vf82d85a_6eefd aws-java-sdk-ec2:1.12.287-357.vf82d85a_6eefd aws-java-sdk-ecr:1.12.287-357.vf82d85a_6eefd aws-java-sdk-ecs:1.12.287-357.vf82d85a_6eefd aws-java-sdk-efs:1.12.287-357.vf82d85a_6eefd aws-java-sdk-elasticbeanstalk:1.12.287-357.vf82d85a_6eefd aws-java-sdk-iam:1.12.287-357.vf82d85a_6eefd aws-java-sdk-logs:1.12.287-357.vf82d85a_6eefd aws-java-sdk-minimal:1.12.287-357.vf82d85a_6eefd aws-java-sdk-sns:1.12.287-357.vf82d85a_6eefd aws-java-sdk-sqs:1.12.287-357.vf82d85a_6eefd aws-java-sdk-ssm:1.12.287-357.vf82d85a_6eefd badge:1.9.1 basic-branch-build-strategies:1.3.2 blueocean:1.25.3 blueocean-autofavorite:1.2.5 blueocean-bitbucket-pipeline:1.25.3 blueocean-commons:1.26.0 blueocean-config:1.25.3 blueocean-core-js:1.26.0 blueocean-dashboard:1.25.3 blueocean-display-url:2.4.1 blueocean-events:1.25.3 blueocean-git-pipeline:1.26.0 blueocean-github-pipeline:1.26.0 blueocean-i18n:1.25.3 blueocean-jira:1.25.3 blueocean-jwt:1.26.0 blueocean-personalization:1.25.3 blueocean-pipeline-api-impl:1.26.0 blueocean-pipeline-editor:1.25.3 blueocean-pipeline-scm-api:1.26.0 blueocean-rest:1.26.0 blueocean-rest-impl:1.26.0 blueocean-web:1.26.0 bootstrap4-api:4.6.0-3 bootstrap5-api:5.1.3-6 bouncycastle-api:2.25 branch-api:2.1051.v9985666b_f6cc build-blocker-plugin:1.7.8 build-name-setter:2.2.0 build-timeout:1.20 build-user-vars-plugin:1.8 caffeine-api:2.9.3-65.v6a_47d0f4d1fe checks-api:1.7.2 cloud-stats:0.27 cloudbees-bitbucket-branch-source:762.v969cfe087fc0 cloudbees-disk-usage-simple:0.10 cloudbees-folder:6.740.ve4f4ffa_dea_54 cloudfoundry:2.3.2 clover:4.13.0 cmakebuilder:4.1.1 command-launcher:1.6 commons-lang3-api:3.12.0-36.vd97de6465d5b_ commons-text-api:1.10.0-27.vb_fa_3896786a_7 conditional-buildstep:1.4.2 config-file-provider:3.9.0 configuration-as-code:1569.vb_72405b_80249 conjur-credentials:1.0.12 conjur-simple-integration:0.0.1 copyartifact:1.46.3 credentials:1087.1089.v2f1b_9a_b_040e4 credentials-binding:523.vd859a_4b_122e6 cvs:2.19 disk-usage:0.28 display-url-api:2.3.6 docker-commons:1.21 docker-java-api:3.2.13-37.vf3411c9828b9 docker-plugin:1.2.10 docker-workflow:563.vd5d2e5c4007f durable-task:504.vb10d1ae5ba2f ec2:1.68 echarts-api:5.3.0-2 email-ext:2.87 envinject:2.847.vb_fa_18490fa_d6 envinject-api:1.192.va_13643e71792 extended-read-permission:3.2 external-monitor-job:191.v363d0d1efdf8 favorite:2.4.1 font-awesome-api:6.0.0-1 ghprb:1.42.2 git:4.11.5 git-client:3.11.2 git-parameter:0.9.18 git-server:1.11 gitea:1.4.1 github:1.34.3.1 github-api:1.303-400.v35c2d8258028 github-branch-source:1677.v731f745ea_0cf github-pr-comment-build:86.v23ae6d00ab99 github-pullrequest:0.4.0 gradle:1.38 greenballs:1.15.1 groovy:453.vcdb_a_c5c99890 groovy-postbuild:2.5 handlebars:3.0.8 handy-uri-templates-2-api:2.1.8-1.0 hashicorp-vault-pipeline:1.4 hashicorp-vault-plugin:359.v2da_3b_45f17d5 htmlpublisher:1.29 http_request:1.14 icon-shim:3.0.0 instant-messaging:1.48 ivy:2.1 jackson2-api:2.14.1-313.v504cdd45c18b jakarta-activation-api:2.0.1-2 jakarta-mail-api:2.0.1-2 javadoc:217.v905b_86277a_2a_ javax-activation-api:1.2.0-5 javax-mail-api:1.6.2-5 jaxb:2.3.7-1 jdk-tool:1.5 jenkins-design-language:1.26.0 jidoka-jenkins-plugin:2.4.0 jira:3.7 jjwt-api:0.11.5-77.v646c772fddb_0 jnr-posix-api:3.1.7-3 job-dsl:1.78.3 job-import-plugin:3.5 jobConfigHistory:1133.v0f5420f85053 jquery:1.12.4-1 jquery-detached:1.2.1 jquery-ui:1.0.2 jquery3-api:3.6.1-1 jsch:0.1.55.2 junit:1.58 jx-pipelines:1.0.15 kubernetes:3580.v78271e5631dc kubernetes-client-api:5.12.1-187.v577c3e368fb_6 kubernetes-credentials:0.9.0 ldap:2.8 localization-support:1.1 localization-zh-cn:1.0.24 lockable-resources:2.14 m2release:0.16.2 mailer:435.438.v5b_81173f5b_a_1 mapdb-api:1.0.9.0 mask-passwords:3.0 matrix-auth:3.1 matrix-project:758.v7a_ea_491852f3 maven-plugin:3.18 mercurial:2.16 metrics:4.1.6.1 momentjs:1.1.1 monitoring:1.91.0 node-iterator-api:1.5.1 nodejs:1.5.1 nodelabelparameter:1.10.3 okhttp-api:4.9.3-105.vb96869f8ac3a p4:1.12.2 pam-auth:1.7 parameter-separator:1.3 parameterized-trigger:2.44 pipeline-build-step:2.16 pipeline-github:2.8-138.d766e30bb08b pipeline-githubnotify-step:49.vf37bf92d2bc8 pipeline-graph-analysis:188.v3a01e7973f2c pipeline-groovy-lib:612.v84da_9c54906d pipeline-input-step:466.v6d0a_5df34f81 pipeline-milestone-step:100.v60a_03cd446e1 pipeline-model-api:2.2118.v31fd5b_9944b_5 pipeline-model-declarative-agent:1.1.1 pipeline-model-definition:2.2118.v31fd5b_9944b_5 pipeline-model-extensions:2.2118.v31fd5b_9944b_5 pipeline-rest-api:2.23 pipeline-stage-step:293.v200037eefcd5 pipeline-stage-tags-metadata:2.2118.v31fd5b_9944b_5 pipeline-stage-view:2.23 pipeline-utility-steps:2.12.0 plain-credentials:1.8 plot:2.1.10 plugin-util-api:2.16.0 popper-api:1.16.1-2 popper2-api:2.11.4-1 prometheus:2.0.11 promoted-builds:873.v6149db_d64130 pubsub-light:1.16 rebuild:1.33 resource-disposer:0.18 role-strategy:3.2.0 run-condition:1.5 saml:2.296.v0016349946db_ scm-api:621.vda_a_b_055e58f7 script-security:1190.v65867a_a_47126 simple-theme-plugin:103.va_161d09c38c7 slack:608.v19e3b_44b_b_9ff slave-status:1.6 snakeyaml-api:1.31-84.ve43da_fb_49d0b sonar:2.14 sse-gateway:1.25 ssh-agent:1.24.1 ssh-credentials:277.280.v1e86b_7d0056b_ ssh-slaves:1.806.v2253cedd3295 sshd:3.1.0 structs:324.va_f5d6774f3a_d subversion:2.15.3 swarm:3.32 throttle-concurrents:2.7 timestamper:1.17 token-macro:321.vd7cc1f2a_52c8 translation:1.16 trilead-api:1.67.vc3938a_35172f variant:1.4 violation-comments-to-github:1.96 windows-slaves:1.8 workflow-aggregator:2.7 workflow-api:1200.v8005c684b_a_c6 workflow-basic-steps:994.vd57e3ca_46d24 workflow-cps:2729.2732.vda_e3f07b_5a_f8 workflow-cps-global-lib:609.vd95673f149b_b workflow-durable-task-step:1190.vc93d7d457042 workflow-job:1189.va_d37a_e9e4eda_ workflow-multibranch:716.vc692a_e52371b_ workflow-scm-step:400.v6b_89a_1317c9a_ workflow-step-api:639.v6eca_cd8c04a_a_ workflow-support:839.v35e2736cfd5c ws-cleanup:0.41 ```

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

RHEL / CentOS, Linux EL7

Reproduction steps

Let's define a GitHub PR status as (ContextName, Result).

  1. Setup a Jenkins pipeline with GitHub Pull Request Builder enabled
  2. Create a PR in the GitHub repo to trigger a Jenkins job (this would trigger a job that exposes in the GitHub page a "pending" state for the status with the initial name, let's say "default") -> GitHub PR Status is then (default, Pending)
  3. Update the Jenkins pipeline to change the status context of the ghprb integration (say from "default" -> "Jenkins Build")
  4. The Jenkins job started by step 2 finishes now (after step 3).

Expected Results

I would expect to have only one status on the build, either one of the two cases for the check after finishing the Jenkins job:

  1. The Jenkins config did not propagate to the job that was in progress, and the job gets to see the status (Default, Passed) in GitHub; the Jenkins config update will then only affect future jobs
  2. The Jenkins config propagated to the job that was in progress, and the job gets to see only the updated context name at the end of the job (Jenkins Build, Passed)

Actual Results

The Job ends up generating 2 statuses that persist after the job is done for the GitHub PR: (Default, Pending) and (Jenkins Build, Passed).

Anything else?

No response