Skip to content

Create /ship quick action to create MR pipeline and set auto-merge

What does this MR do and why?

This merge request adds a new /ship quick action command for merge requests that automates the process of getting code merged. When a user types /ship in a merge request comment, it automatically creates a CI/CD pipeline to test the code and enables auto-merge so the merge request will be automatically merged once all checks pass.

The feature includes proper permission checking to ensure only authorized users can use the command, and it's protected by a feature flag that's currently disabled by default. The system also tracks usage metrics to monitor how often this feature is used.

This streamlines the developer workflow by combining two common actions (running tests and setting up auto-merge) into a single command. This reduces the need for maintainers to wait for a pipeline to be created (which could take even 2 minutes), making it faster and easier for developers to get their code changes merged into the main codebase.

Related to #210538

Screenshots or screen recordings

Screen Recording 2025-10-14 720.mov

How to set up and validate locally

  1. Enable the feature flag

    Feature.enable(:ship_mr_quick_action)
  2. Create a project with a simple .gitlab-ci.yml that runs a merge request pipeline

    workflow:
      rules:
        - if: $CI_MERGE_REQUEST_ID
        - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
    
    test:
      image: busybox
      script: sleep 10
  3. Create a mere request.

  4. Wait for the first pipeline to complete.

  5. Use /ship quick action

  6. Expect a new pipeline to be created, the MR set as MWCP and finally merged automatically!

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Fabio Pitino

Merge request reports

Loading