DocsHow toUse Code Owners

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.

  1. Create a new branch with a name like add-codeowners
  2. Navigate to the root directory of the Frigg repository
  3. Create a new file named CODEOWNERS in project root
  4. 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.
  1. Create a merge request with the new CODEOWNERS file
  2. Wait for the pipeline to succeed and have someone approve the Merge Request
    • Note: Changelist should be empty, because the CODEOWNERS is not a Frigg Resource
  3. Merge the Merge Request
  4. Navigate to the CODEOWNERS file in your project
  5. Check whether Example User appears 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.