Skip to content

Use merge request MERGE ref for attached merge request pipelines

Shinya Maeda requested to merge create-merge-pipelines into master

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.

  1. User creates or updates a merge request
  2. The system invokes ::MergeRequests::CreateService (or ::MergeRequests::RefreshService)
  3. The system creates a merge ref from a source branch into a target branch. This ref is known as refs/merge-requests/:iid/merge
  4. The system creates a pipeline on the merge ref. This pipeline is known as (attached) merge request pipelines.
  5. 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?

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

Context: When ci_use_merge_request_ref feature flag is disabled

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?

Edited by Kamil Trzciński

Merge request reports