Skip to content

Refactor all_pipelines in Merge request in order to support all pipelines for merge request

Shinya Maeda requested to merge use-only-all-pipelines into master

What does this MR do?

MergeRequest#all_pipelines (which uses Ci::Pipeline.for_merge_request) cannot get detached merge request pipelines (See the terminoligy in https://gitlab.com/gitlab-org/gitlab-ee/issues/7380) because those pipelines have a head ref of the merge request (e.g. refs/merge-requests/:iid/head) instead of the branch name (e.g. feature-1). This MR address the problem to let MergeRequest#all_pipelines fetch all relevant pipelines on the merge request.

This MR also drops the scope Ci::Pipeline.for_merge_request and implement the get-related-pipelines-logic in MergeRequest#all_pipelines. We reduce the number of the scopes for the SSOT that MergeRequest#all_pipelines fetches the related pipeliens whereas Ci::Pipeline#all_merge_requests fetches the related merge requests. This was the conclusion brought with @ayufan in the previous (abandoned) MR.

What are the relevant issue numbers?

Related gitlab-ee#7380 #58454 (moved)

EE MR for test purpose => https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9871

Does this MR meet the acceptance criteria?

Edited by Kamil Trzciński

Merge request reports