API support for merge trains merge when pipeline succeeds
Problem to solve
Our merge request API hasn't been updated to support our 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
Further details
We currently support merging immediately using the Accept MR API endpoint.
We also support merge when pipeline succeeds using the same API mentioned above with an additional merge_when_pipeline_succeeds: true
parameter.
In its current state, making a request to the Accept MR API endpoint with merge_when_pipeline_succeeds: true
in a project that has merge trains enabled has the same effect as clicking the "Start merge train when pipeline succeeds" button in the UI. This is a bit confusing and not correct.
Proposal
Mirror the changes we made to our internal API in order to support merge trains: gitlab-foss!28595 (merged). 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 following value:
merge_when_pipeline_succeeds
add_to_merge_train_when_pipeline_succeeds
If we go this route, we should also update the Get single MR endpoint with a new property, available_auto_merge_strategies
, which indicates what auto merge strategies are available.
Permissions and Security
There are no special considerations from a permissions/security standpoint. Existing permissions for who can merge / add to merge train should be respected.
Documentation
The section of our documentation that would be most affected by this change would be the Accept MR API.
The Get single MR endpoint may also need to be updated, depending on our implementation.
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.