Drop all merge requests from merge train when the target branch is deleted
Problem
Currently, when the target branch is deleted, merge requests are dropped from merge train lazily with merge errors.
We can drop MRs proactively by catching the branch-deletion event.
Since this is an edge case that master branch is rarely deleted (it's protected by default), the priority is low.
Follow-up
The following discussion from !23395 (merged) should be addressed:
-
@dosuken123 started a discussion: We don't need to check the merge train status when branch is deleted or created. We need to check only when the target branch is updated. This guard is reduce the number of calls to
CheckStatusService
, which saves up some process time fromUpdateMergeRequestWorker
.Actually, we should also consider the case when the target branch is deleted. We should drop all MRs from train in this case. But likely, it should not be checked here. I'll create a follow-up issue for this.