Expose skip_branch_pipelines_for_mrs in the REST API

Release notes

The Skip branch pipelines for merge requests project setting can now be read and written through the projects REST API, so you can enable it with automation, the GitLab Terraform provider, or bulk scripts instead of visiting the UI for each project.

Problem to solve

The setting shipped in 19.2 as a UI-only checkbox. GraphQL support already exists — the Types::Ci::CiCdSettingType field and the Mutations::Ci::ProjectCiCdSettingsUpdate argument both landed in !241641 (merged).

This blocks two things:

  1. Customers who provision projects through automation cannot opt in at scale. Enabling the setting across hundreds of projects currently means hundreds of UI visits.
  2. It blocks changing the default for newly created projects. Customers who automate project creation and deliberately want the existing dual-pipeline behavior need a way to turn the setting back off at creation time — otherwise flipping the default is a breaking change for them. This was the explicit reason for decoupling the opt-in setting from the default change.

Proposal

Follow the existing ci_delete_pipelines_in_seconds / ci_display_pipeline_variables pattern.

Most of the plumbing is already in place: Project delegates skip_branch_pipelines_for_mrs to ci_cd_settings inside the with_options prefix: :ci block in app/models/project.rb, so both the ci_skip_branch_pipelines_for_mrs reader and its writer already exist. Remaining work:

  • lib/api/helpers/projects_helpers.rb — add optional :ci_skip_branch_pipelines_for_mrs, type: Boolean to optional_update_params_ce, and :ci_skip_branch_pipelines_for_mrs to the update-params list.
  • lib/api/entities/project.rbexpose :ci_skip_branch_pipelines_for_mrs inside the existing admin_project with_options block, matching the authorize: :admin_project used on the GraphQL field.
  • spec/requests/api/project_attributes.yml — remove skip_branch_pipelines_for_mrs from unexposed_attributes and add skip_branch_pipelines_for_mrs: ci_skip_branch_pipelines_for_mrs to remapped_attributes.
  • Documentation: doc/api/projects.md, cross-linked from Skip branch pipelines for merge requests.

On naming: the database column is skip_branch_pipelines_for_mrs, but the REST attribute should be ci_skip_branch_pipelines_for_mrs for consistency with the other ci_-prefixed CI/CD project attributes. Hence the remapped_attributes entry.

Out of scope

The GitLab Terraform provider change. That lives in gitlab-org/terraform-provider-gitlab and should be a follow-up issue filed there once this ships — the provider cannot expose what the REST API does not.

Intended users

Feature Usage Metrics

Existing setting-enablement metrics cover adoption. Worth confirming that the usage counter also increments for API-driven changes, not only UI changes.

Success criteria

  • GET /projects/:id returns ci_skip_branch_pipelines_for_mrs
  • PUT /projects/:id accepts ci_skip_branch_pipelines_for_mrs
  • Documentation updated in doc/api/projects.md
  • (optional) Follow-up issue filed against the Terraform provider
Edited by 🤖 GitLab Bot 🤖