GitlabUpdateCommitStatus creates sometimes two builds in Gitlab
Before submitting an issue I have first:
- [x] read the documentation on the homepage
- [x] searched for similar already existing issue
Issue
Incorrect update of the gitlab commit from jenkins multibranch pipeline
Context
- Gitlab plugin version: 1.4.5
- Gitlab version: GitLab Community Edition 8.11.2
- Jenkins version: 2.4.7
- Job type: Pipeline (Multi-Branch)
Logs & Traces
Problem description
I have a Gitlab Server configured with a webhook for push events that triggers a multibranch jenkins pipeline. The pipeline updates the gitlab commit status with just one build/stage. In most cases everything is ok but sometimes i see two builds in Gitlab that point to the same jenkins job and the overall state is IN PROGRESS although the job has passed
Here's the relevant part of the pipeline:
gitlabBuilds(builds: ['Jenkins Pipeline']) {
gitlabCommitStatus(name: 'Jenkins Pipeline') {
executeTestsStageHelper(pipelineConfigurationJson)
}
}
Attach is a screenshot of one problematic commit:

Both builds in the screenshot refer to the same jenkins build. Another thing to note is that all commits are merges (i,e, this is the master branch and all commits are related to merging a branch in the master branch)
Can you give the correct version of the gitlab-plugin? There is no 3.05 version. 1.4.5 is the latest, released last week.
Updated - it's 1.4.5
Hmm. I haven't seen this reported before. I did just notice something about your Pipeline code snippet - you don't need to use the gitlabBuilds block if there is only one stage within the build that is going to send status to GitLab. You can simply wrap that one step of the build in the gitlabCommitStatus block. This is how I do my builds. I wonder if this might be causing a problem. If I'm understanding your setup correctly, I would suggest you try removing the gitlabBuilds block and see if the problem goes away.
I removed and i still see the issue. The difference is that now i do not see "running" on the overall commits page which is better. This is what i see now sometimes:

@pgeorgiev333 did you ever resolve this?
No. I switched to a different approach. Now i just use
updateGitlabCommitStatus(name: 'Build and Test', state: 'failed') and it works fine.
Do you think we need to update the documentation to make this clearer?
Well, what i am using is just a different approach. Both should work
On Jul 22, 2017 01:32, "Owen Mehegan" [email protected] wrote:
Do you think we need to update the documentation to make this clearer?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jenkinsci/gitlab-plugin/issues/511#issuecomment-317127728, or mute the thread https://github.com/notifications/unsubscribe-auth/AQK4tuDnWlM1NSYsEXHQ39ZpbtML1_hgks5sQSb8gaJpZM4MHQIl .