Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/user/project/code_owners.md')
-rw-r--r--doc/user/project/code_owners.md95
1 files changed, 50 insertions, 45 deletions
diff --git a/doc/user/project/code_owners.md b/doc/user/project/code_owners.md
index 63ea84e42c9..3135aa78719 100644
--- a/doc/user/project/code_owners.md
+++ b/doc/user/project/code_owners.md
@@ -5,11 +5,11 @@ info: "To determine the technical writer assigned to the Stage/Group associated
type: reference
---
-# Code Owners **(STARTER)**
+# Code Owners **(PREMIUM)**
-> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/6916)
-in [GitLab Starter](https://about.gitlab.com/pricing/) 11.3.
-> - 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.
+> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/6916) in GitLab 11.3.
+> - Code Owners for Merge Request approvals was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/4418) in GitLab Premium 11.9.
+> - Moved to GitLab Premium in 13.9.
## Introduction
@@ -18,7 +18,7 @@ to find out who should review or approve merge requests.
Additionally, if you have a question over a specific file or
code block, it may be difficult to know who to find the answer from.
-GitLab Code Owners is a feature to define who owns specific
+The GitLab Code Owners feature defines who owns specific
files or paths in a repository, allowing other users to understand
who is responsible for each file or path.
@@ -32,7 +32,7 @@ the process of finding the right reviewers and approvers for a given
merge request.
In larger organizations or popular open source projects, Code Owners
-can also be useful to understand who to contact if you have
+can help you understand who to contact if you have
a question that may not be related to code review or a merge request
approval.
@@ -49,12 +49,12 @@ You can choose to add the `CODEOWNERS` file in three places:
- Inside the `docs/` directory
The `CODEOWNERS` file is valid for the branch where it lives. For example, if you change the code owners
-in a feature branch, they won't be valid in the main branch until the feature branch is merged.
+in a feature branch, the changes aren't valid in the main branch until the feature branch is merged.
If you introduce new files to your repository and you want to identify the code owners for that file,
-you have to update `CODEOWNERS` accordingly. If you update the code owners when you are adding the files (in the same
-branch), GitLab will count the owners as soon as the branch is merged. If
-you don't, you can do that later, but your new files will not belong to anyone until you update your
+you must update `CODEOWNERS` accordingly. If you update the code owners when you are adding the files (in the same
+branch), GitLab counts the owners as soon as the branch is merged. If
+you don't, you can do that later, but your new files don't belong to anyone until you update your
`CODEOWNERS` file in the TARGET branch.
When a file matches multiple entries in the `CODEOWNERS` file,
@@ -73,29 +73,32 @@ The user that would show for `README.md` would be `@user2`.
## Approvals by Code Owners
-Once you've added Code Owners to a project, you can configure it to
+After you've added Code Owners to a project, you can configure it to
be used for merge request approvals:
- As [merge request eligible approvers](merge_requests/merge_request_approvals.md#code-owners-as-eligible-approvers).
- As required approvers for [protected branches](protected_branches.md#protected-branches-approval-by-code-owners). **(PREMIUM)**
-Developer or higher [permissions](../permissions.md) are required in order to
+Developer or higher [permissions](../permissions.md) are required to
approve a merge request.
-Once set, Code Owners are displayed in merge requests widgets:
+After it's set, Code Owners are displayed in merge request widgets:
![MR widget - Code Owners](img/code_owners_mr_widget_v12_4.png)
-While the `CODEOWNERS` file can be used in addition to Merge Request [Approval Rules](merge_requests/merge_request_approvals.md#approval-rules),
-it can also be used as the sole driver of merge request approvals
-(without using [Approval Rules](merge_requests/merge_request_approvals.md#approval-rules)).
-To do so, create the file in one of the three locations specified above and
-set the code owners as required approvers for [protected branches](protected_branches.md#protected-branches-approval-by-code-owners).
-Use [the syntax of Code Owners files](code_owners.md#the-syntax-of-code-owners-files)
-to specify the actual owners and granular permissions.
+While you can use the `CODEOWNERS` file in addition to Merge Request
+[Approval Rules](merge_requests/merge_request_approvals.md#approval-rules),
+you can also use it as the sole driver of merge request approvals
+without using [Approval Rules](merge_requests/merge_request_approvals.md#approval-rules):
-Using Code Owners in conjunction with [Protected Branches](protected_branches.md#protected-branches-approval-by-code-owners)
-will prevent any user who is not specified in the `CODEOWNERS` file from pushing
+1. Create the file in one of the three locations specified above.
+1. Set the code owners as required approvers for
+ [protected branches](protected_branches.md#protected-branches-approval-by-code-owners).
+1. Use [the syntax of Code Owners files](code_owners.md#the-syntax-of-code-owners-files)
+ to specify the actual owners and granular permissions.
+
+Using Code Owners in conjunction with [protected branches](protected_branches.md#protected-branches-approval-by-code-owners)
+prevents any user who is not specified in the `CODEOWNERS` file from pushing
changes for the specified files/paths, except those included in the
**Allowed to push** column. This allows for a more inclusive push strategy, as
administrators don't have to restrict developers from pushing directly to the
@@ -114,13 +117,13 @@ in the `.gitignore` file followed by one or more of:
- The `@name` of one or more groups that should be owners of the file.
- Lines starting with `#` are ignored.
-The order in which the paths are defined is significant: the last pattern that
-matches a given path will be used to find the code owners.
+The path definition order is significant: the last pattern
+matching a given path is used to find the code owners.
### Groups as Code Owners
-> - [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/53182) in GitLab Starter 12.1.
-> - 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.
+> - [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/53182) in GitLab 12.1.
+> - Group and subgroup hierarchy support was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/32432) in GitLab 13.0.
Groups and subgroups members are inherited as eligible Code Owners to a
project, as long as the hierarchy is respected.
@@ -131,7 +134,7 @@ suppose you have a project called "Project A" within the group and a
"Project B" within the subgroup.
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
+the Subgroup Y. 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:
![Eligible Code Owners](img/code_owners_members_v13_4.png)
@@ -142,9 +145,9 @@ Code Owners:
![Invite subgroup members to become eligible Code Owners](img/code_owners_invite_members_v13_4.png)
-Once invited, any member (`@user`) of the group or subgroup can be set
-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:
+After being invited, any member (`@user`) of the group or subgroup can be set
+as Code Owner to files of the Project A or B, and the entire Group X
+(`@group-x`) or Subgroup Y (`@group-x/subgroup-y`), as follows:
```plaintext
# A member of the group or subgroup as Code Owner to a file
@@ -162,7 +165,7 @@ file.md @group-x @group-x/subgroup-y
### Code Owners Sections **(PREMIUM)**
-> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/12137) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.2 behind a feature flag, enabled by default.
+> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/12137) in GitLab Premium 13.2 behind a feature flag, enabled by default.
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42389) in GitLab 13.4.
Code Owner rules can be grouped into named sections. This allows for better
@@ -185,8 +188,8 @@ changes, to set their own independent patterns by specifying discrete sections i
teams can be added as reviewers.
Sections can be added to `CODEOWNERS` files as a new line with the name of the
-section inside square brackets. Every entry following it is assigned to that
-section. The following example would create 2 Code Owner rules for the "README
+section inside square brackets. Every entry following is assigned to that
+section. The following example would create two Code Owner rules for the "README
Owners" section:
```plaintext
@@ -196,7 +199,7 @@ internal/README.md @user2
```
Multiple sections can be used, even with matching file or directory patterns.
-Reusing the same section name will group the results together under the same
+Reusing the same section name groups the results together under the same
section, with the most specific rule or last matching pattern being used. For
example, consider the following entries in a `CODEOWNERS` file:
@@ -213,7 +216,7 @@ model/db @gl-database
README.md @gl-docs
```
-This will result in 3 entries under the "Documentation" section header, and 2
+This results in three entries under the "Documentation" section header, and two
entries under "Database". Case is not considered when combining sections, so in
this example, entries defined under the sections "Documentation" and
"DOCUMENTATION" would be combined into one, using the case of the first instance
@@ -227,9 +230,11 @@ the rules for "Groups" and "Documentation" sections:
#### Optional Code Owners Sections **(PREMIUM)**
-> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/232995) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.8 behind a feature flag, enabled by default.
+> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/232995) in GitLab Premium 13.8 behind a feature flag, enabled by default.
+> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/53227) in GitLab 13.9.
-When you want to make a certain section optional, you can do so by adding a code owners section prepended with the caret `^` character. Approvals from owners listed in the section will **not** be required. For example:
+To make a certain section optional, add a code owners section prepended with the
+caret `^` character. Approvals from owners listed in the section are **not** required. For example:
```plaintext
[Documentation]
@@ -242,13 +247,13 @@ When you want to make a certain section optional, you can do so by adding a code
*.go @root
```
-The optional code owners section will be displayed in merge requests under the **Approval Rules** area:
+The optional code owners section displays in merge requests under the **Approval Rules** area:
![MR widget - Optional Code Owners Sections](img/optional_code_owners_sections_v13_8.png)
-If a section is duplicated in the file, and one of them is marked as optional and the other isn't, the requirement prevails.
+If a section is duplicated in the file, and one of them is marked as optional and the other isn't, the requirement prevails.
-For example, the code owners of the "Documentation" section below will still be required to approve merge requests:
+For example, the code owners of the "Documentation" section below is still required to approve merge requests:
```plaintext
[Documentation]
@@ -264,12 +269,12 @@ For example, the code owners of the "Documentation" section below will still be
*.txt @root
```
-Optional sections in the code owners file are currently treated as optional only
-when changes are submitted via merge requests. If a change is submitted directly
-to the protected branch, approval from code owners will still be required, even if the
-section is marked as optional. We plan to change this in a
+Optional sections in the code owners file are treated as optional only
+when changes are submitted by using merge requests. If a change is submitted directly
+to the protected branch, approval from code owners is still required, even if the
+section is marked as optional. We plan to change this behavior in a
[future release](https://gitlab.com/gitlab-org/gitlab/-/issues/297638),
-where direct pushes to the protected branch will be allowed for sections marked as optional.
+and allow direct pushes to the protected branch for sections marked as optional.
## Example `CODEOWNERS` file