Use merge request MERGE ref for attached merge request pipelines
What does this MR do?
As the contrast of https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/25504, this MR lets users create (attached) merge request pipelines. This is the core functionality of https://gitlab.com/gitlab-org/gitlab-ee/issues/7380.
Here is the step-by-step explanation how attached merge request pipelines are going to be created.
- User creates or updates a merge request
- The system invokes
::MergeRequests::CreateService
(or::MergeRequests::RefreshService
) - The system creates a merge ref from a source branch into a target branch. This ref is known as
refs/merge-requests/:iid/merge
- The system creates a pipeline on the merge ref. This pipeline is known as (attached) merge request pipelines.
- User sees the prospective results of merge pipelines. If it fails, maintainers should hold off merging because it could lead master:broken
What are the relevant issue numbers?
- https://gitlab.com/gitlab-org/gitlab-ee/issues/7380
- gitlab-runner#3983 (closed)
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/25233
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/25417
- https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9572
CE backport
Manual QA - Wed Mar 27 08:25:39 UTC 2019
Context: When runner is new
Expected:
-
The job fetches MERGE merge request ref ( refs/merge-requests/:iid/merge
) and succeeds -
Correctly renders detached merge request pipeline identifer in merge request widget -
Correctly renders detached merge request pipeline identifer in pipeline list page -
Correctly renders detached merge request pipeline identifer in pipeline details page -
Correctly renders detached merge request pipeline identifer in job details page
Context: When the project setting Settings > General > Merge Requests > MR pipelines checkbox is disabled
Expected:
-
Create detached merge request pipeline and succeeds
Context: When conflicts happens when creating merge ref
Expected:
-
Create detached merge request pipeline and succeeds
Context: When merge request is WIP
Expected:
-
Create detached merge request pipeline and succeeds
Context: When source project is a forked project
Expected:
-
Create detached merge request pipeline and succeeds
Context: When runner is old
Expected:
-
The job fails with the reason that they're using an old runner
ci_use_merge_request_ref
feature flag is disabled
Context: When Expected:
-
Create detached merge request pipeline and succeeds
Context: When source project is a forked project
Expected:
-
Create detached merge request pipeline and succeeds
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary - [-] Documentation created/updated via this MR
- [-] Documentation reviewed by technical writer or follow-up review issue created
-
Tests added for this feature/bug - [-] Tested in all supported browsers
-
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides - [-] Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process.
-
EE specific content should be in the top level /ee
folder - [-] For a paid feature, have we considered GitLab.com plans, how it works for groups, and is there a design for promoting it to users who aren't on the correct plan?
-
Security reports checked/validated by reviewer
Edited by Kamil Trzciński (Back 2025-01-01)