Skip to content

When launching pipelines on merge requests from Gitlab, Jenkins creates a pipeline for the source branch in the project pipeline list. #1780

Description

@ubertrololo

When launching pipelines on merge requests from Gitlab, Jenkins creates a pipeline for the source branch in the project pipeline list.

For example, there is an open merge request from the testdev branch to the dev branch.

Creating a commit in branch testdev

Gitlab runs job jenkins via a web hook and creates an external pipeline,
but it is shown as a commit to the testdev branch, not as a merge request.

in the pipeline parameters

# Pipeline:
id:           230426                                  
status:       failed                                  
source:       external                                
ref:          testdev                  
sha:          6eaf06ae685593129630a4e9cd0a414b15a36012
tag:          false                                   
yaml Errors:                                          
user:         cicd-sc                                 
created:      2025-05-27 11:41:49.662 +0000 UTC       
started:      2025-05-27 11:42:07.917 +0000 UTC       
updated:      2025-05-27 11:48:45.509 +0000 UTC       

For example, a pipeline in gitlab on a merge request

# Pipeline:
id:           230387                                  
status:       success                                 
source:       merge_request_event                     
ref:          refs/merge-requests/1274/head           
sha:          6742db9b08b1d1c5b5554dfe1b07a8775fdf9cd1
tag:          false                                   
yaml Errors:                                          
user:         smitt                            
created:      2025-05-27 11:14:34.577 +0000 UTC       
started:      2025-05-27 11:14:52.002 +0000 UTC       
updated:      2025-05-27 11:38:48.712 +0000 UTC   

in the correct case, ref points to MR (refs/merge-requests/1274/head)

In the settings of the gitlab webhook, only the event from MR is set, in the settings of the jenkins job (gitlab-plugin) it is set to accept MR, the trigger for push events is disabled.

The expected result is to get a pipeline display with the merge request attribute from Jenkins.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions