Skip to content

Use max of approvals_before_merge between project and MR at runtime

Mark Chao requested to merge 10055-approvals-required-max into master

What does this MR do?

The original intention is for MR to always take the stricter approval_required count setting. So if project requires 2 approval, but MR sets 1, it should always require 2 approvals.

This MR uses max of approvals_before_merge between project and MR at runtime.

Previously, MR#approvals_before_merge is nil when it is <= project's value. (from clamp_approvals_before_merge). Then it would default to project setting if it is nil. This changed in f480d145, which would always persist a min value.

This caused regression that updating MR would fail if project's value is increased later on.

The relationship between value being nil and validation can be easily overlooked.

Removing validation and taking the max of the two makes logic clearer.

Does this MR meet the acceptance criteria?

Conformity

Performance 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

Closes #10055 (closed) Closes #10909 (closed)

Edited by Mark Chao

Merge request reports