How to use Code Owners with Frigg
This guide shows you how to create a CODEOWNERS file in order to shield specific Frigg resources from being altered by the wrong people.
- Create a new branch with a name like
add-codeowners - Navigate to the root directory of the Frigg repository
- Create a new file named
CODEOWNERSin project root - Add the required CODEOWNERS syntax. For example:
# Protect the CODEOWNERS file itself
/CODEOWNERS @example-user # Code Owners can be both users or groups.
# Groups will only include direct members.
# Protect the resources for the Top Level Group
/resources/gitlab/top-level-gitlab-group/top-level-gitlab-group.yaml @example-user
# Protect the resources for the Frigg repository
/resources/gitlab/top-level-gitlab-group/frigg.yaml @example-user- Note: whenever you assign a GitLab Group as a Code Owner, this group needs to either be a parent of the project the file exists in.
Or the group needs to be added as a member to the project with at least the Access Level
Developer.
- Create a merge request with the new
CODEOWNERSfile - Wait for the pipeline to succeed and have someone approve the Merge Request
- Note: Changelist should be empty, because the
CODEOWNERSis not a Frigg Resource
- Note: Changelist should be empty, because the
- Merge the Merge Request
- Navigate to the
CODEOWNERSfile in your project - Check whether
Example Userappears as a codeowner of the file:

ℹ️ For more information about GitLab Code Owners, please take a look at the Code Owners documentation on the GitLab website.