Slash command support for merge train
What does this MR do?
This MR adds slash command support for merge train. Users can add a merge request by typing /merge
in MRs.
Here are the key changes:
- Introduce
MergeOrchestrationService
to handle "Merge Immediately" and "Merge Automatically (e.g. MWPS, Merge Train, Add to merge train when pipeline succeeds)" in a smart way. This allows us to have a centralized place to handle the logic of "choose-the-best-way-to-merge-it". - Fix a bug on auto merge services (e.g.
MergeWhenPipelineService
) that it becomes available even though the user doesn't have permission to merge. - Add
AutoMergeService#preferred_strategy
method to return the most preferred strategy at the moment based on the project setting. - Extend
QuickActions::MergeRequestActions
to support the most preferred strategy to be chosen when it's available. Since "Merge Immediately" option is the most unpreferred option all the time, it's considered as a fallback option if no auto merge strategies are available. - Add memoization to avoid repeated call on
available_for?
.
related #32336 (closed)
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Shinya Maeda