jenkinsci / jenkinsci/gitlab-branch-source-plugin

[JENKINS-75698] Jenkinsfile MR pipeline status is ignored if there is a Gitlab MR pipeline

Open
#734 4 comments 0 reactions 0 assignees View on GitHub
component:gitlab-branch-source-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
134
Forks
113
PR merge metrics
No merged PRs in 30d

Description

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:


But GitLab uses another ref for merge request statuses:



  • either "refs/merge-requests//head"

  • or "refs/merge-requests//merge"

Actual Result

When both triggered, there are 2 "pipeline results" in GitLab



  • one pipeline "branch" from Jenkins with ref: ""

  • one pipeline "merge request" from GitLab with ref: "refs/merge-requests//head" (or "refs/merge-requests//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

---
Originally reported by francisbolduc, imported from: Jenkinsfile MR pipeline status is ignored if there is a Gitlab MR pipeline


  • assignee: baymac
  • status: Open
  • priority: Major
  • component(s): gitlab-branch-source-plugin
  • resolution: Unresolved
  • votes: 1
  • watchers: 4
  • imported: 20251216-182730

Raw content of original issue

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:


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

environment

```
Jenkins 2.504.1

gitlab-branch-source: 718.v40b_5f0e67cd3
```

7 attachments

- [2025-10-23-gitlab-mr-overview.png](https://issues.jenkins.io/secure/attachment/65014/2025-10-23-gitlab-mr-overview.png)
> ![2025-10-23-gitlab-mr-overview.png](https://issues.jenkins.io/secure/attachment/65014/2025-10-23-gitlab-mr-overview.png)
- [2025-10-23-gitlab-mr-pipelines.png](https://issues.jenkins.io/secure/attachment/65013/2025-10-23-gitlab-mr-pipelines.png)
> ![2025-10-23-gitlab-mr-pipelines.png](https://issues.jenkins.io/secure/attachment/65013/2025-10-23-gitlab-mr-pipelines.png)
- [Jenkinsfile](https://issues.jenkins.io/secure/attachment/64410/Jenkinsfile)
- [gitlab-ci.yml](https://issues.jenkins.io/secure/attachment/64412/gitlab-ci.yml)
- [image-2025-10-23-12-22-27-071.png](https://issues.jenkins.io/secure/attachment/65010/image-2025-10-23-12-22-27-071.png)
> ![image-2025-10-23-12-22-27-071.png](https://issues.jenkins.io/secure/attachment/65010/image-2025-10-23-12-22-27-071.png)
- [image-2025-10-23-12-28-07-314.png](https://issues.jenkins.io/secure/attachment/65011/image-2025-10-23-12-28-07-314.png)
> ![image-2025-10-23-12-28-07-314.png](https://issues.jenkins.io/secure/attachment/65011/image-2025-10-23-12-28-07-314.png)
- [image-2025-10-23-12-38-12-126.png](https://issues.jenkins.io/secure/attachment/65012/image-2025-10-23-12-38-12-126.png)
> ![image-2025-10-23-12-38-12-126.png](https://issues.jenkins.io/secure/attachment/65012/image-2025-10-23-12-38-12-126.png)

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.