Define default owners for CODEOWNERS sections
Release notes
For each code owners section, you can now define default code owners that are applied to files and directories referenced in the section that don't have an owner assigned. This way you don't have to repeat the same owners in many lines.
In this example, the directories docs/
and blog/
are owned by the default owner @docs-team
. ee/docs/
is owned by the @product-team
.
[Documentation] @docs-team
docs/
blog/
ee/docs/ @product-team
https://docs.gitlab.com/ee/user/project/code_owners.html#section-default-owners
Problem
The CODEOWNERS feature allows to define a section containing multiple file patterns in it. Often a section is a group of files that are owned by the same group of people. This forces us to repeat the same owners for each file pattern despite those been all organized into the same section.
[Documentation]
ee/docs/ @docs
docs/ @docs
[Database]
README.md @database
model/db/ @database
In addition, the repeated owners can sometimes make it harder to read the file paths.
Proposal
Allow the section definition to take an optional list of owners that are used as default value when the file path doesn't specify one. If the file path specifies the code owner then the latter is applied instead of the default one.
[Documentation] @docs
ee/docs/
docs/
[Database] @database
README.md
model/db/
lib/database/ @platform # use @platoform instead of @database
[Checkout] @teams/checkout/backend @alice
app/models/checkout/
app/workers/checkout/
app/views/checkout/ @teams/checkount/frontend @alice # the account Alice remains the owner while ownershipt switches from backend to frontend