jenkinsci / jenkinsci/gitlab-plugin

gitlab status is inconsistent

Open
#1,575 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
1.4k
Forks
615
Avg merge
4h 32m
Merged PRs (30d)
10

Description

### Jenkins and plugins versions report

Jenkins: 2.401.1
OS: Linux - 5.4.0-162-generic
Java: 17.0.7 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
---
analysis-model-api:11.6.0
ant:497.v94e7d9fffa_b_9
antisamy-markup-formatter:159.v25b_c67cd35fb_
apache-httpcomponents-client-4-api:4.5.14-150.v7a_b_9d17134a_5
artifactory:3.18.9
authentication-tokens:1.53.v1c90fd9191a_b_
badge:1.9.1
blueocean:1.27.5.1
blueocean-bitbucket-pipeline:1.27.5.1
blueocean-commons:1.27.5.1
blueocean-config:1.27.5.1
blueocean-core-js:1.27.5.1
blueocean-dashboard:1.27.5.1
blueocean-display-url:2.4.2
blueocean-events:1.27.5.1
blueocean-git-pipeline:1.27.5.1
blueocean-github-pipeline:1.27.5.1
blueocean-i18n:1.27.5.1
blueocean-jwt:1.27.5.1
blueocean-personalization:1.27.5.1
blueocean-pipeline-api-impl:1.27.5.1
blueocean-pipeline-editor:1.27.5.1
blueocean-pipeline-scm-api:1.27.5.1
blueocean-rest:1.27.5.1
blueocean-rest-impl:1.27.5.1
blueocean-web:1.27.5.1
bootstrap5-api:5.3.0-1
bouncycastle-api:2.29
branch-api:2.1122.v09cb_8ea_8a_724
build-environment:1.7
build-failure-analyzer:2.4.1
build-timeout:1.31
build-timestamp:1.0.3
build-user-vars-plugin:1.9
buildtriggerbadge:251.vdf6ef853f3f5
caffeine-api:3.1.6-115.vb_8b_b_328e59d8
checks-api:2.0.0
cloudbees-bitbucket-branch-source:825.va_6a_dc46a_f97d
cloudbees-folder:6.848.ve3b_fd7839a_81
command-launcher:100.v2f6722292ee8
commons-lang3-api:3.12.0-36.vd97de6465d5b_
commons-text-api:1.10.0-36.vc008c8fcda_7b_
config-file-provider:953.v0432a_802e4d2
copyartifact:722.v0662a_9b_e22a_c
cppcheck:1.26
credentials:1268.v3f0d043d60e9
credentials-binding:604.vb_64480b_c56ca_
data-tables-api:1.13.5-1
database:191.vd5981b_97a_5fa_
database-mysql:1.4
display-url-api:2.3.7
docker-commons:439.va_3cb_0a_6a_fb_29
docker-workflow:563.vd5d2e5c4007f
downstream-buildview:69.v16da_b_2c36f6c
durable-task:510.v324450f8dca_4
echarts-api:5.4.0-5
email-ext:2.99
embeddable-build-status:412.v09da_db_1dee68
envinject:2.908.v66a_774b_31d93
envinject-api:1.199.v3ce31253ed13
extended-choice-parameter:376.v2e02857547b_a_
extended-read-permission:53.v6499940139e5
favorite:2.4.2
font-awesome-api:6.4.0-2
forensics-api:2.3.0
git:5.2.0
git-client:4.4.0
git-parameter:0.9.19
github:1.37.1
github-api:1.314-431.v78d72a_3fe4c3
github-branch-source:1728.v859147241f49
gitlab-api:5.3.0-91.v1f9a_fda_d654f
gitlab-merge-request-jenkins:2.0.0
gitlab-oauth:1.18
gitlab-plugin:1.7.15
gradle:2.8.1
handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953
hidden-parameter:138.v2a_c30d04e566
htmlpublisher:1.31
influxdb:3.5
instance-identity:173.va_37c494ec4e5
ionicons-api:56.v1b_1c8c49374e
jackson2-api:2.15.2-350.v0c2f3f8fc595
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.8-1
jdk-tool:66.vd8fa_64ee91b_d
jenkins-design-language:1.27.5.1
jenkins_plugin:1.0-SNAPSHOT (private-09/15/2022 16:20-bensonqin)
jersey2-api:2.40-1
jfrog:1.5.0
jjwt-api:0.11.5-77.v646c772fddb_0
jobConfigHistory:1227.v7a_79fc4dc01f
jquery3-api:3.7.0-1
jsch:0.2.8-65.v052c39de79b_2
junit:1217.v4297208a_a_b_ce
ldap:682.v7b_544c9d1512
locale:314.v22ce953dfe9e
localization-support:1.2
localization-zh-cn:1.0.24
mailer:457.v3f72cb_e015e5
matrix-auth:3.1.10
matrix-project:808.v5a_b_5f56d6966
maven-plugin:3.23
metrics:4.2.18-442.v02e107157925
mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_
mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_
multiple-scms:0.8
okhttp-api:4.11.0-145.vcb_8de402ef81
pam-auth:1.10
parameterized-trigger:2.46
pipeline-build-step:505.v5f0844d8d126
pipeline-config-history:1.6
pipeline-github-lib:42.v0739460cda_c4
pipeline-graph-analysis:202.va_d268e64deb_3
pipeline-groovy-lib:656.va_a_ceeb_6ffb_f7
pipeline-input-step:477.v339683a_8d55e
pipeline-milestone-step:111.v449306f708b_7
pipeline-model-api:2.2144.v077a_d1928a_40
pipeline-model-definition:2.2144.v077a_d1928a_40
pipeline-model-extensions:2.2144.v077a_d1928a_40
pipeline-rest-api:2.33
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2144.v077a_d1928a_40
pipeline-stage-view:2.33
pipeline-timeline:1.0.3
pipeline-utility-steps:2.16.0
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:3.3.0
prism-api:1.29.0-7
pubsub-light:1.17
python:1.3
rebuild:320.v5a_0933a_e7d61
resource-disposer:0.22
role-strategy:670.vc71a_a_c00039e
scm-api:676.v886669a_199a_a_
script-security:1251.vfe552ed55f8d
secondary-timestamper-plugin:1.1
snakeyaml-api:1.33-95.va_b_a_e3e47b_fa_4
sse-gateway:1.26
ssh-credentials:305.v8f4381501156
ssh-slaves:2.877.v365f5eb_a_b_eec
sshd:3.303.vefc7119b_ec23
structs:324.va_f5d6774f3a_d
timestamper:1.25
token-macro:359.vb_cde11682e0c
trilead-api:2.84.v72119de229b_7
uno-choice:2.7
validating-string-parameter:2.8
variant:59.vf075fe829ccb
warnings-ng:10.4.0
workflow-aggregator:596.v8c21c963d92d
workflow-api:1241.v4edc8b_44933b_
workflow-basic-steps:1017.vb_45b_302f0cea_
workflow-cps:3717.va_180a_fe9d3cd
workflow-durable-task-step:1247.v7f9dfea_b_4fd0
workflow-job:1316.vd2290d3341a_f
workflow-multibranch:756.v891d88f2cd46
workflow-scm-step:415.v434365564324
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:839.v35e2736cfd5c
ws-cleanup:0.45

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

I set the webhooks in gitab,when gitlab mr isrequest。but when the jenkins pipeline runned ,then gitlab status is inconsistent
![5JrYyjC6Ag](https://github.com/jenkinsci/gitlab-plugin/assets/79590928/a254b7dd-469b-4708-ac32-4e4142648821)

### Reproduction steps

// this is my pipeline
pipeline{
agent {
node {
label 'Linux'
}
}
options {
gitLabConnection('gitlab')
timestamps ()
buildDiscarder(logRotator(numToKeepStr:'50'))
}

stages{
stage("getcode"){
steps{
script{
try{
sh """ env """
echo """ 0 工作空间是 ${WORKSPACE} """
// do checkout scmGit()

updateGitlabCommitStatus name: 'getcode', state: 'success'
}catch(err){
echo "get code failed -----"
updateGitlabCommitStatus name: 'getcode', state: 'failed'
throw err
}
}
}
}

stage("code_review"){
steps{
script {
try{
echo """ 2 工作空间是 ${WORKSPACE} """
// do some python script ; may error
updateGitlabCommitStatus name: 'code_review', state: 'success'
}catch(err){
echo "code_review failed -----"
updateGitlabCommitStatus name: 'code_review', state: 'failed'
//throw err
}
}
}
}

stage("build"){
steps{
script {
try{
echo """ 1 工作空间是 ${WORKSPACE} """
// build ; may error
updateGitlabCommitStatus name: 'build', state: 'success'
}catch(err){
echo "build failed -----"
updateGitlabCommitStatus name: 'build', state: 'failed'
throw err
}
}
}
}

stage("TCA"){
steps{
script {
try{
// do some python script ; may error
updateGitlabCommitStatus name: 'TCA', state: 'success'
}catch(err){
echo "TCA failed -----"
updateGitlabCommitStatus name: 'TCA', state: 'failed'
//throw err
}
}
}
}
}

post {
always {
script{
echo """ in post --- """
sh """
cd ${WORKSPACE}/devops_script/tools && python3 mr_pipeline_post.py ${currentBuild.result} ${gitlabTargetRepoName}.json

"""
}
}
}

}

### Expected Results

gitlab mr pipeline status will be consistent

### Actual Results

gitlab mr pipeline status not consistent

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.