Skip to content

Inherit project approval rules for merge request creation

Vasilii Iakliushin requested to merge 388140_fix_approval_rules_inheritance into master

What does this MR do and why?

Contributes to #388140 (closed)

Problem

We don't create approval rules for merge request unless they are explicitly provided by the user.

It currently works for creating MR via UI, because frontend provides a list of approval rules in approval_rules_attributes param.

It doesn't work for merge_request API endpoint, because we don't populate this attribute when it's not provided.

Solution

The code is complicated enough and requires a refactoring. The least invacive approach is to generate approval_rules_attributes list if it was not provided.

That should ensure that MergeRequest::CreateService will inherit project approval rules even if the user didn't provide them.

How to set up and validate locally

  1. See comment: #388140 (comment 1335979022)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vasilii Iakliushin

Merge request reports