jenkinsci / gitlab-branch-source-plugin

A Jenkins Plugin for GitLab Multibranch Pipeline jobs and Folder Organization
https://plugins.jenkins.io/gitlab-branch-source
MIT License
124 stars 94 forks source link

GitLab does not get Notified of Aborted Branch Pipeline Build when Merge Request gets Created duing Pending Build #442

Open ravage84 opened 2 months ago

ravage84 commented 2 months ago

Jenkins and plugins versions report

Environment Jenkins: 2.440.3 OS: Linux - 4.15.0-228-generic Java: 11.0.23 - Ubuntu (OpenJDK 64-Bit Server VM) --- ace-editor:1.1 active-directory:2.36 analysis-core:1.96 analysis-model-api:12.4.0 ant:511.v0a_a_1a_334f41b_ antisamy-markup-formatter:162.v0e6ec0fcfcf6 apache-httpcomponents-client-4-api:4.5.14-208.v438351942757 apache-httpcomponents-client-5-api:5.3.1-110.v77252fb_d4da_5 asm-api:9.7-33.v4d23ef79fcc8 atlassian-jira-software-cloud:2.0.15 authentication-tokens:1.119.v50285141b_7e1 bootstrap4-api:4.6.0-6 bootstrap5-api:5.3.3-1 bouncycastle-api:2.30.1.78.1-248.ve27176eb_46cb_ branch-api:2.1178.v969d9eb_c728e build-keeper-plugin:19.va_df8a_2c65123 caffeine-api:3.1.8-133.v17b_1ff2e0599 checks-api:2.2.0 checkstyle:4.0.0 cloudbees-folder:6.901.vb_4c7a_da_75da_3 clover:4.14.2.596.vb_4d6475e990b_ cloverphp:0.6 command-launcher:115.vd8b_301cc15d0 commons-lang3-api:3.16.0-82.ve2b_07d659d95 commons-text-api:1.12.0-129.v99a_50df237f7 conditional-buildstep:1.4.3 credentials:1371.vfee6b_095f0a_3 credentials-binding:681.vf91669a_32e45 data-tables-api:2.1.4-1 delivery-pipeline-plugin:1.4.2 display-url-api:2.204.vf6fddd8a_8b_e9 docker-commons:443.v921729d5611d docker-workflow:580.vc0c340686b_54 dry:3.0.0 dtkit-api:3.0.2 durable-task:568.v8fb_5c57e8417 echarts-api:5.5.1-1 eddsa-api:0.3.0-4.v84c6f0f4969e email-ext:1814.v404722f34263 external-monitor-job:215.v2e88e894db_f8 font-awesome-api:6.6.0-1 forensics-api:2.5.0 git:5.4.1 git-client:5.0.0 git-server:126.v0d945d8d2b_39 gitlab-api:5.6.0-97.v6603a_83f8690 gitlab-branch-source:704.vc7f1202d7e14 gitlab-oauth:1.19 gitlab-plugin:1.8.1 gson-api:2.11.0-41.v019fcf6125dc handlebars:3.0.8 handy-uri-templates-2-api:2.1.8-30.v7e777411b_148 htmlpublisher:1.36 instance-identity:185.v303dc7c645f9 ionicons-api:74.v93d5eb_813d5f jackson2-api:2.17.0-379.v02de8ec9f64c jakarta-activation-api:2.1.3-1 jakarta-mail-api:2.1.3-1 javadoc:280.v050b_5c849f69 javax-activation-api:1.2.0-7 javax-mail-api:1.6.2-10 jaxb:2.3.9-1 jdepend:1.3.1 jdk-tool:80.v8a_dee33ed6f0 jersey2-api:2.44-151.v6df377fff741 jira:3.13 jnr-posix-api:3.1.19-2 jobConfigHistory:1241.v07634fa_18896 joda-time-api:2.12.7-29.v5a_b_e3a_82269a_ jquery:1.12.4-1 jquery-detached:1.2.1 jquery3-api:3.7.1-2 jsch:0.2.16-86.v42e010d9484b_ json-api:20240303-41.v94e11e6de726 json-path-api:2.9.0-58.v62e3e85b_a_655 junit:1296.vb_f538b_c88630 ldap:725.v3cb_b_711b_1a_ef lockable-resources:1255.vf48745da_35d0 mailer:472.vf7c289a_4b_420 mapdb-api:1.0.9-40.v58107308b_7a_7 matrix-auth:3.2.2 matrix-project:832.va_66e270d2946 maven-plugin:3.23 metrics:4.2.21-451.vd51df8df52ec mina-sshd-api-common:2.13.2-125.v200281b_61d59 mina-sshd-api-core:2.13.2-125.v200281b_61d59 momentjs:1.1.1 pam-auth:1.11 parameterized-trigger:806.vf6fff3e28c3e pipeline-build-step:540.vb_e8849e1a_b_d8 pipeline-graph-analysis:216.vfd8b_ece330ca_ pipeline-graph-view:243.vc9e11fec486a_ pipeline-groovy-lib:730.ve57b_34648c63 pipeline-input-step:495.ve9c153f6067b_ pipeline-milestone-step:119.vdfdc43fc3b_9a_ pipeline-model-api:2.2205.vc9522a_9d5711 pipeline-model-definition:2.2205.vc9522a_9d5711 pipeline-model-extensions:2.2205.vc9522a_9d5711 pipeline-rest-api:2.34 pipeline-stage-step:312.v8cd10304c27a_ pipeline-stage-tags-metadata:2.2205.vc9522a_9d5711 pipeline-stage-view:2.34 plain-credentials:183.va_de8f1dd5a_2b_ plot:2.1.12 plugin-usage-plugin:4.5 plugin-util-api:4.1.0 pmd:4.0.0 popper-api:1.16.1-3 popper2-api:2.11.6-5 prism-api:1.29.0-17 publish-over:0.22 publish-over-ssh:1.25 run-condition:1.7 scm-api:696.v778d637b_a_762 script-security:1354.va_70a_fe478c7f shelve-project-plugin:3.2 snakeyaml-api:2.2-121.v5a_68b_9300b_d4 ssh-credentials:343.v884f71d78167 sshd:3.330.vc866a_8389b_58 structs:338.v848422169819 subversion:1269.v53185011cd9f tasks:4.53 token-macro:400.v35420b_922dcb_ trilead-api:2.147.vb_73cc728a_32e variant:60.v7290fc0eb_b_cd violations:0.7.11 warnings-ng:11.4.1 workflow-aggregator:600.vb_57cdd26fdd7 workflow-api:1336.vee415d95c521 workflow-basic-steps:1058.vcb_fc1e3a_21a_9 workflow-cps:3946.v7935cb_edb_f82 workflow-cps-global-lib:612.v55f2f80781ef workflow-durable-task-step:1371.vb_7cec8f3b_95e workflow-job:1400.v7fd111b_ec82f workflow-multibranch:773.vc4fe1378f1d5 workflow-scm-step:427.v4ca_6512e7df1 workflow-step-api:678.v3ee58b_469476 workflow-support:920.v59f71ce16f04 xunit:3.1.5

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

Both Ubuntu Server 18.04 GitLab-side not known.

Reproduction steps

  1. Have a Multibranch Pipeline Job with a GitLab Branch Source configured with Discover Branches behavior added and set to Only branches that are not also filed as MRs.
  2. Create a branch
  3. Let Jenkins find branch
  4. Push changes to this branch
  5. Immediately create PR while build is not yet finished

Expected Results

  1. Branch pipeline get marked as disabled due to being obsolete [OK]
  2. Running branch pipeline gets aborted [OK]
  3. MR pipeline gets created [OK]
  4. GitLab gets notified of MR pipeline status once finished [OK]
  5. GitLab gets notified of branch pipeline status after being aborted [FAILED]

Actual Results

GitLab does not seem to get notified of aborted pipeline.

Anything else?

This is how the MR pipeline status looks on the GitLab side:

grafik

https://gitlab.company.tld/group/project/-/pipelines/3010

This is from the end of the console log of the MR pipeline build in Jenkins:

[Pipeline] End of Pipeline [GitLab Pipeline Status] Notifying merge request build status: SUCCESS BRANCH/MR-44 #2: This commit looks good. [GitLab Pipeline Status] Notified Finished: SUCCESS

https://jenkins.company.tld/job/PROJECT/job/MR-44/2/console

This is from the end of the console log of the branch pipeline build in Jenkins:

[Pipeline] End of Pipeline org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 93872e80-3c67-4ee0-9818-8d2462687a8f Finished: ABORTED

https://jenkins.company.tld/job/PROJECT/job/BRANCH-2669/1/console

Are you interested in contributing a fix?

Unfortunately no, since I'm not a Java developer. Haven't touched Java in almost 20 years.

But I'm willing to install & check an unstable build of this plugin on our setup to verfiy a potential fix.