Description:

This check verifies that GitLab requires at least one approval before a merge request can be merged into the target branch. Requiring reviewer approval ensures that code changes are reviewed by another authorized user before being incorporated into the codebase.


Note: This check requires a GitLab Premium or Ultimate plan. The setting it evaluates depends on a paid feature that isn’t available on the Free plan.On the Free plan, the setting doesn’t appear in the GitLab UI or API, so it can’t be configured. The check will show as Failed or Not applicable, regardless of how the rest of the group or project is set up.


Rationale:

Code reviews help identify defects, security vulnerabilities, violations of coding standards, and unintended changes before code reaches protected branches. Requiring at least one approval improves code quality, strengthens change management controls, and reduces the risk of unreviewed or unauthorized changes being merged.


Impact:

  • Increase the time required to merge changes.

  • Require collaboration between developers and reviewers.

  • Improve code quality and security.

  • Reduce the likelihood of defects reaching production environments.


Default Value:

Disabled. By default, GitLab projects do not require merge request approvals. Approval requirements must be explicitly configured at the project or group level. Default setting: Approvals Required: 0


Pre-requisites:

  • Maintainer or Owner access to the project

  • An existing GitLab project


Test Plan:

  1. Sign in to GitLab at https://gitlab.com.

  2. Navigate to the target project.

  3. Navigate to Settings → Merge requests.

  4. Locate the Merge Request Approvals or Approval Rules section.

  5. Review the configured approval requirements.

  6. Verify that Approvals Required is set to 1 or greater.


Implementation Steps:

  1. Sign in to GitLab at https://gitlab.com.

  2. Navigate to the target project.

  3. Select Settings → Merge requests.

           

  1. Locate Merge Request Approvals or Approval Rules.

  2. Edit Merge Request Approvals or create new Merge Request Approvals.   

    

  1. Enter a meaningful ruleset name and select the target branch(All Branches). Set the required number of approvals to 1. Add one or more eligible reviewers or groups.

            

  1. Save the configuration.


Backout Plan:

  1. Sign in to GitLab at https://gitlab.com.

  2. Navigate to Settings → Merge requests.

  3. Locate Merge Request Approvals or Approval Rules.

  4. Change Approvals Required from 1 to 0 (or restore the previous value). Or delete the particular rule.

           

  1. Save the changes.

  2. Confirm that project operations are normal after the rollback.


Reference: