Configurable merge train pipeline limits (1/4)
What does this MR do and why?
This is MR 1 of 4 in a stacked series that adds configurable merge train pipeline limits, addressing gitlab-org/gitlab#374188.
| MR | Branch | Base | Content |
|---|---|---|---|
| 1 (this MR) | 374188-1-add-max-pipelines-per-merge-train-plan-limit |
master |
Database migrations |
| 2 | 374188-2-backend-logic-and-api |
374188-1-add-max-pipelines-per-merge-train-plan-limit |
Backend logic, REST API, GraphQL, tests (!228371 (merged)) |
| 3 | 374188-3-admin-and-project-ui |
374188-2-backend-logic-and-api |
Admin UI, Project UI, validations (!228380 (merged)) |
| 4 | 374188-4-documentation |
master |
Documentation (!228488 (merged)) |
Currently, merge trains have a hardcoded limit of 20 parallel pipelines
(DEFAULT_CONCURRENCY = 20 in ee/app/services/merge_trains/refresh_service.rb).
For teams with large pipelines, this overwhelms CI runners with no workaround.
This MR adds two database columns to support both iterations from the issue:
-
plan_limits.max_pipelines_per_merge_train(smallint, default:20,NOT NULL) Instance-wide limit configurable by self-managed admins via the Plan Limits API and Admin UI. (Iteration 1) -
project_ci_cd_settings.max_pipelines_per_merge_train(smallint, nullable) Project-level override.NULLmeans the plan limit applies. When set, the effective limit ismin(plan_limit, project_limit). The plan limit always wins over the project limit. (Iteration 2)
Files to review in this MR
db/migrate/20260330195543_add_max_pipelines_per_merge_train_to_plan_limits.rb- New migrationdb/migrate/20260330195601_add_max_pipelines_per_merge_train_to_project_ci_cd_settings.rb- New migrationdb/schema_migrations/20260330195543- Auto-generateddb/schema_migrations/20260330195601- Auto-generateddb/structure.sql- Auto-generated schema update
Database migrations
Migration 1: plan_limits
add_column :plan_limits, :max_pipelines_per_merge_train,
:smallint, default: 20, null: falseSmall table (one row per plan), safe to add column with default.
Migration 2: project_ci_cd_settings
add_column :project_ci_cd_settings, :max_pipelines_per_merge_train,
:smallint, default: nilNullable column with no default, so no table rewrite required.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
- This MR contains only database migrations (no application logic)
- Migrations are reversible (
changemethod) - Column types and defaults match the implementation guide in the issue
Related issues
Part of gitlab-org/gitlab#374188 (parent epic: gitlab-org&2219)"