Allow users to select code owners sections as approval rule on merge requests
Problem to solve
From time to time, users who have configured optional merge request approvals need to require an approval for a specific change that absolutely must be reviewed. These configurations can be:
- Users who are using code owners to define code ownership but not for approvals (ie. GitLab)
- Users who are using code owners with required approval but have an optional section
If a change is created for an optional section but maintainer deems this must be approved as an exception, there is no way to create a merge request approval rule that is configured with the section name (only users and groups are available for approval rules).
Currently we handle the requiring of code owner approval through the protected branch POST (create) endpoint here.
Proposal
Allow users to select a code owners section as an approval rule (for both project settings and individual merge requests)
Note Make sure to use Gitlab::CodeOwners.sections
to fetch available sections