Why do approval rules show as optional?
Overview
When using merge request approvals as a part of your code review process, you may find that some or all of your approval rules appear as "optional" and are no longer required to merge a merge request. Optional rules don't block merging even if they haven't received approvals, unless you created rules through a merge request approval policy.
Environment
Impacted offerings:
- GitLab.com
- GitLab Dedicated
- GitLab Self-Managed
Answer
Approval rules in GitLab may show as optional for different reasons depending on your GitLab plan and configuration.
-
When using GitLab without a subscription all approval rules are optional.
- If your approval rules were working previously without any other change in your environment, ensure that you still have access to a GitLab subscription in your relevant namespace or instance.
-
When using GitLab Premium or Ultimate, these are some of the most common situations when an approval rule can appear as optional:
- When the only eligible approver for the rule is the merge request author themselves.
- When no eligible approvers are assigned to the rule.
- When required approvals exceed the number of eligible approvers for the rule.
Additional Information
There are a number of requirements for an approver to be eligible, including:
- The applicable user must be a member of the project, the project's immediate parent group, a group that has been shared with the project, or a group added as approvers.
- Users with the Developer or Reporter roles may be restricted from approving merge requests.
- When a group of users has been added as an approver, only direct members of the group can approve the rule.
- If Code Owners is used, the owners of these files become eligible approvers