Skip to content

Slash command support for merge train

Shinya Maeda requested to merge slash-command-support-for-merge-train into master

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

screenshot_73

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

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

Merge request reports