Only add matching roles for code owner role approvers
What does this MR do and why?
In #282438 (comment 2239115122) it was discovered that code owner role approvers were being populated across multiple entries.
In this MR we fix this so we only add roles which are found in the extractor.
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
![]() |
![]() |
How to set up and validate locally
- Enable the
codeowner_role_approvers
feature flag. - Create a new project and add a separate user each for developer and maintainer.
- Enable the codeowner switch for the main branch in
settings/repository
under protected branches. - Create a CODEOWNERS file in the root of the project.
- Create two files called 'developer_file' and 'maintainer_file' respectively in the root of the project.
- In the CODEOWNER file add:
developer_file @@developers
maintainer_file @@maintainers
- Create a new merge request with changes targeting both developer_file and maintainer_file.
- Notice that approval is required from your developer user for the develope_file and from the maintainer user for the maintainer file.
Related to #282438 (closed)
Edited by Gavin Hinfey