Commit aa65d826 authored by Marcia Ramos's avatar Marcia Ramos

Merge branch 'docs-codeowners-clarify' into 'master'

Clarify documentation for code owners group hierarchy

See merge request gitlab-org/gitlab!39059
parents 7d0f2426 22ab7aea
...@@ -9,7 +9,6 @@ type: reference ...@@ -9,7 +9,6 @@ type: reference
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/6916) > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/6916)
in [GitLab Starter](https://about.gitlab.com/pricing/) 11.3. in [GitLab Starter](https://about.gitlab.com/pricing/) 11.3.
> - [Support for group namespaces](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/53182) added in GitLab Starter 12.1.
> - Code Owners for Merge Request approvals was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/4418) in [GitLab Premium](https://about.gitlab.com/pricing/) 11.9. > - Code Owners for Merge Request approvals was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/4418) in [GitLab Premium](https://about.gitlab.com/pricing/) 11.9.
## Introduction ## Introduction
...@@ -108,40 +107,53 @@ in the `.gitignore` file followed by one or more of: ...@@ -108,40 +107,53 @@ in the `.gitignore` file followed by one or more of:
- A user's `@username`. - A user's `@username`.
- A user's email address. - A user's email address.
- The `@name` of one or more groups that should be owners of the file. - The `@name` of one or more groups that should be owners of the file.
- Lines starting with `#` are escaped.
Groups must be added as [members of the project](members/index.md), The order in which the paths are defined is significant: the last pattern that
or they will be ignored. matches a given path will be used to find the code owners.
Starting in [GitLab 13.0](https://gitlab.com/gitlab-org/gitlab/-/issues/32432), ### Groups as Code Owners
you can additionally specify groups or subgroups from the project's upper group
hierarchy as potential code owners, without having to invite them specifically
to the project. Groups outside the project's hierarchy or children beneath the
hierarchy must still be explicitly invited to the project in order to show as
Code Owners.
For example, consider the following hierarchy for the example project > - [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/53182) in GitLab Starter 12.1.
`example_project`: > - Group and subgroup hierarchy support was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/32432) in [GitLab Starter](https://about.gitlab.com/pricing/) 13.0.
```plaintext Groups and subgroups members are inherited as eligible Code Owners to a
group >> sub-group >> sub-subgroup >> example_project >> file.md project, as long as the hierarchy is respected.
```
For example, consider a given group called "Group X" (slug `group-x`) and a
"Subgroup Y" (slug `group-x/subgroup-y`) that belongs to the Group X, and
suppose you have a project called "Project A" within the group and a
"Project B" within the subgroup.
Any of the following groups would be eligible to be specified as code owners: The eligible Code Owners to Project B are both the members of the Group X and
the Subgroup Y. And the eligible Code Owners to the Project A are just the
members of the Group X, given that Project A doesn't belong to the Subgroup Y:
- `@group` ![Eligible Code Owners](img/code_owners_members_v13_4.png)
- `@group/sub-group`
- `@group/sub-group/sub-subgroup`
In addition, any groups that have been invited to the project using the But you have the option to [invite](members/share_project_with_groups.md)
**Members** tool will also be recognized as eligible code owners. the Subgroup Y to the Project A so that their members also become eligible
Code Owners:
The order in which the paths are defined is significant: the last ![Invite subgroup members to become eligible Code Owners](img/code_owners_invite_members_v13_4.png)
pattern that matches a given path will be used to find the code
owners.
Starting a line with a `#` indicates a comment. This needs to be Once invited, any member (`@user`) of the group or subgroup can be set
escaped using `\#` to address files for which the name starts with a as Code Owner to files of the Project A or B, as well as the entire Group X
`#`. (`@group-x`) or Subgroup Y (`@group-x/subgroup-y`), as exemplified below:
```plaintext
# A member of the group or subgroup as Code Owner to a file
file.md @user
# All group members as Code Owners to a file
file.md @group-x
# All subgroup members as Code Owners to a file
file.md @group-x/subgroup-y
# All group and subgroup members as Code Owners to a file
file.md @group-x @group-x/subgroup-y
```
### Code Owners Sections **(PREMIUM)** ### Code Owners Sections **(PREMIUM)**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment