Draft: Add ff to ignore mergeability race when creating merged results pipeline
What does this MR do and why?
There is a race between merged results pipeline creation and target
branch changes, as both can affect the mergeability status of an MR.
When an external mergeability check "wins", the merge request pipeline
creation currently falls back to a detached
pipeline.
In this MR, we add a feature flag
merged_results_pipeline_ignore_target_branch_race
, changing this
behavior to ignore a failed mergeability check if the merged results
ref was successfully updated without conflicts.
The flag is disabled by default.
Part of #469380
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
-
In your GDK, add an artificial delay into
MergeRequests::MergeabilityCheckService#update_merge_status
as follows:def update_merge_status return false unless merge_request.recheck_merge_status? if merge_request.broken? merge_request.mark_as_unmergeable return false end merge_to_ref_success = merge_to_ref + sleep 120 update_diff_discussion_positions! if merge_to_ref_success if merge_to_ref_success && can_git_merge? merge_request.mark_as_mergeable reload_merge_head_diff true else merge_request.mark_as_unmergeable false end end
-
On a merge request, press the
Run pipeline
button -
Push a change to the MR's target branch (e.g.
master
ormain
) before the artificial delay is up
Observe:
- When the feature flag
merged_results_pipeline_ignore_target_branch_race
is disabled, adetached
pipeline is created - When the feature flag is enabled, a
merged_results
pipeline is created