Command Line and API Support for Merge Trains
_This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc._ ### Problem to solve Our [merge request API](https://docs.gitlab.com/ee/api/merge_requests.html#accept-mr) hasn't been updated to support our [merge trains](https://docs.gitlab.com/ee/ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/) feature and public API support is lacking in Merge Train. This means, users cannot automate their workflow via API. Today, users can control via UI, which is manual operation. ### Intended users * [Sasha (Software Developer)](https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/#sasha-software-developer) ### Details Mirror the changes we made to our internal API in order to support merge trains: https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/28595. Instead of sending a request to the `/merge` endpoint with `merge_when_pipeline_succeeds: true`, the endpoint would instead accept a `auto_merge_strategy` parameter with any of the values. If we go this route, we should also update the [Get single MR endpoint](https://docs.gitlab.com/ee/api/merge_requests.html#get-single-mr) with a new property, `available_auto_merge_strategies`, which indicates what auto merge strategies are available. **Merge Request API** Additional public API support for Merge Trains. We will work on this first to support automation efforts by platform engineering teams including the GitLab team so we can dogfood the feature. Here are the proposed endpoints to manipulate Merge Requests. - [x] `GET api/v4/projects/:id/merge_trains/:target_branch` - https://gitlab.com/gitlab-org/gitlab/-/issues/381068 https://gitlab.com/gitlab-org/gitlab/-/merge_requests/102568 - [x] `GET api/v4/projects/:id/merge_trains/merge_requests/:merge_request_iid` - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/102665 - [ ] `POST api/v4/projects/:id/merge_trains/merge_requests/:merge_request_iid` - https://gitlab.com/gitlab-org/gitlab/-/issues/328650, https://gitlab.com/gitlab-org/gitlab/-/merge_requests/100853 - [x] add to merge train https://gitlab.com/gitlab-org/gitlab/-/issues/328650 - [ ] add to merge train when pipeline succeeds https://gitlab.com/gitlab-org/gitlab/-/issues/32665 - [ ] `DELETE api/v4/projects/:id/merge_trains/merge_requests/:merge_request_iid` **Projects API** In addition we should create an endpoint to support enabling/disabling merge trains (and merged result pipelines) through the Projects API. - [ ]   https://gitlab.com/gitlab-org/gitlab/-/issues/284100+ **git push options** Last we will work to support the use case to add an MR to a merge train with a `git push` option. We may decide to instead support this through [`glab`](https://docs.gitlab.com/ee/integration/glab/) before starting the work. - [ ]   https://gitlab.com/gitlab-org/gitlab/-/issues/32732+ <!-- triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION --> *This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.* <!-- triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION -->
epic