Introduce new graphql attribute for mergeability
Following on from the discussion in the investigation issue, we are going to expose a mergability_status attribute that the front end can use to determine if it is mergeable or not.
Currently, the frontend uses a number of different attributes, and checks to see if and why not the MR is mergable, but consolidating this into one attribute in the backend, we can reduce the complexity and dependency between the Front and Back ends.
The backend currently does the following checks:
CE + EE:
::MergeRequests::Mergeability::CheckOpenStatusService,
::MergeRequests::Mergeability::CheckDraftStatusService,
::MergeRequests::Mergeability::CheckBrokenStatusService,
::MergeRequests::Mergeability::CheckDiscussionsStatusService,
::MergeRequests::Mergeability::CheckCiStatusService
EE only:
::MergeRequests::Mergeability::CheckApprovedService,
::MergeRequests::Mergeability::CheckDeniedPoliciesService,
::MergeRequests::Mergeability::CheckBlockedByOtherMrsService
The functionality of this new attribute should be behind a feature flag in regard to performance related issues.
Backend implementation:
We have two checks that check mergability, mergeable
and mergeable_state
, the first will run the MergeRequests::MergeabilityCheckService.new(self)
service + the mergeable_state
method.
The MergeabilityCheckService
checks from a 'git' point of view. It appears the current way we implement it is to run this service (if needed), and return a 'checking' status until it is completed (changed state).
To do this, we would need to handle the 'checking' case as well, and then after checking run the mergeable_state
checks to see if there is anything stopping a merge.
The current checks, currently do not have a 'error' message associated with them, so we will need to implement these for each one, for example, :failed_ci_check
, :not_approved
...
This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.