Skip to content

Allow users to get Merge Trains entries via Public API

Shinya Maeda requested to merge public-api-for-merge-trains into master

Important note: This MR should be delivered to gitlab.com asap in order to resume dogfooding for merge train regardless of its milestone

What does this MR do?

In order to address #36146 (closed), we need to create a public API to read Merge Train entity. This entity includes duration param, which can be used for alerting when a duration becomes unexpectedly slow.

Here is a couple of reviewing points:

  • We preload associations properly in order to avoid N+1. This is already being tested in spec.
  • Since Merge Train entity includes Pipeline and Merge Request entity as well, we check the user permission for it.
  • This feature is behind merge_trains_api feature flag, thus we can disable the API when we observe unexpected behavior.

Related #36146 (closed), #32665

API format

Endpoint params description
GET api/v4/projects/:id/merge_trains scope, sort Get all merge trains of a project

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