-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Jenkins 2.504.1
gitlab-branch-source: 718.v40b_5f0e67cd3
The issue occurs when there are both a .gitlab-ci.yml and a Jenkinsfile present in repo and triggered in a Merge Request, the MR pipeline status will only consider status from GitLab pipeline (ignoring Jenkins pipeline status).
The issue doesn't occur when only Jenkins pipeline is triggered (where GitLab rules didn't trigger GitLab MR pipeline), the MR pipeline status will consider the Jenkins pipeline status.
gitlab-branch-source-plugin use this GitLab REST API to set the status of a pipeline: https://docs.gitlab.com/api/commits/#set-the-pipeline-status-of-a-commit
And the probable source is from the usage of "status.setRef" where it sets the "branch-name" of the merge request here:
- https://github.com/jenkinsci/gitlab-branch-source-plugin/blob/40b5f0e67cd36c3e8b925baf41b17f907ef32314/src/main/java/io/jenkins/plugins/gitlabbranchsource/helpers/GitLabPipelineStatusNotifier.java#L381
- https://github.com/jenkinsci/gitlab-branch-source-plugin/blob/40b5f0e67cd36c3e8b925baf41b17f907ef32314/src/main/java/io/jenkins/plugins/gitlabbranchsource/helpers/GitLabPipelineStatusNotifier.java#L494
But GitLab uses another ref for merge request statuses:
- either "refs/merge-requests/<mr-iid>/head"
- or "refs/merge-requests/<mr-iid>/merge"
Actual Result
When both triggered, there are 2 "pipeline results" in GitLab
- one pipeline "branch" from Jenkins with ref: "<branch-name>"
- one pipeline "merge request" from GitLab with ref: "refs/merge-requests/<mr-iid>/head" (or "refs/merge-requests/<mr-iid>/merge")
And only the GitLab pipeline status is shown in the MR.
Expected Result
When both triggered, only one pipeline "merge request" including both GitLab jobs statuses and Jenkins pipeline status.
Github issue: https://github.com/jenkinsci/gitlab-branch-source-plugin/issues/493