From 79e88dc22403d8e2354cb2eb5e1fafd99c619ae3 Mon Sep 17 00:00:00 2001 From: Emma Park Date: Fri, 8 Nov 2024 11:54:32 +0000 Subject: [PATCH 1/5] Update index.md --- doc/user/project/codeowners/index.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/doc/user/project/codeowners/index.md b/doc/user/project/codeowners/index.md index f37c910384e6e1..80ffcb0e95bc17 100644 --- a/doc/user/project/codeowners/index.md +++ b/doc/user/project/codeowners/index.md @@ -162,14 +162,11 @@ of the merge request becomes optional. ##### Inviting subgroups to parent groups Inviting **Subgroup Y** to a parent group of **Project A** -[is not supported](https://gitlab.com/gitlab-org/gitlab/-/issues/288851). To set **Subgroup Y** as -Code Owners, [invite this group directly to the project](#inviting-subgroups-to-projects-in-parent-groups) itself. +[is supported](https://gitlab.com/gitlab-org/gitlab/-/issues/498117). When a parent group of Project A invites another group (e.g., Subgroup Y), the invited group is set as a Code Owner. NOTE: -For approval to be required, groups as Code Owners must have a direct membership -(not inherited membership) in the project. Approval can only be optional for groups -that inherit membership. Members in the Code Owners group also must be direct members, -and not inherit membership from any parent groups. +For approval to be required, groups as Code Owners should have a direct membership +or inherited membership in the project. ### Define more specific owners for more specifically defined files or directories -- GitLab From b86d67158a5a2e7356b252d1d404c52054e626f9 Mon Sep 17 00:00:00 2001 From: Emma Park Date: Fri, 8 Nov 2024 15:00:30 +0000 Subject: [PATCH 2/5] Added a diagram and updated the docs --- doc/user/project/codeowners/index.md | 48 ++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/doc/user/project/codeowners/index.md b/doc/user/project/codeowners/index.md index 80ffcb0e95bc17..265e66a65a30e5 100644 --- a/doc/user/project/codeowners/index.md +++ b/doc/user/project/codeowners/index.md @@ -111,6 +111,10 @@ file.md @group-x/subgroup-y file.md @group-x @group-x/subgroup-y ``` +When a group is invited to a parent group, a group higher in your project's hierarchy, +it is assigned Code Owner status. For more information, +see [Inviting subgroups to parent groups](#inviting-subgroups-to-parent-groups). + NOTE: You cannot set a member of a group or subgroup as a Code Owner if [Global SAML group memberships lock](../../group/saml_sso/group_sync.md#global-saml-group-memberships-lock) is enabled. @@ -129,7 +133,7 @@ graph TD In this example: -- **Parent group X** (`group-x`) owns **Project A**. +- **Parent group X** owns **Project A**. - **Parent group X** also contains a subgroup, **Subgroup Y**. (`group-x/subgroup-y`) - **Subgroup Y** owns **Project B**. @@ -138,6 +142,39 @@ The eligible Code Owners are: - **Project A**: the members of **Group X** only, because **Project A** doesn't belong to **Subgroup Y**. - **Project B**: the members of both **Group X** and **Subgroup Y**. +##### Inviting subgroups to parent groups + +Groups invited to parent groups are now valid Code Owners for subgroups. +Inviting **Subgroup Y** to a parent group of **Project A** +[is supported](https://gitlab.com/gitlab-org/gitlab/-/issues/498117). +When a parent group of **Project A** invites another group, the invited group is set as a Code Owner. + +The following is an example of how this works in a multi-level group structure: + +```mermaid +%%{init: { "fontFamily": "GitLab Sans" }}%% +graph LR + accTitle: Diagram of inviting subgroups to parent groups + A[Parent group X] --> |owns| B[Subgroup 1] + A --> |owns| C[Subgroup 2] + B --> |contains| D[Project A] + C --> |contains| E[Project B] + A -.-> |invites| F[Other group] + F -.-> |Code Owner| D + F -.-> |Code Owner| E +``` + +In this example: + +- The **Parent group X** has two subgroups: **Subgroup 1** and **Subgroup 2**. +- Each subgroup contains a project: **Project A** and **Project B**. +- **Other group** is invited to the **Parent group X**. +- As a result, the **Other group** is a valid Code Owner for both **Project A** and **Project B**. + +NOTE: +To require approvals, Code Owners groups must have a direct membership +or inherited membership in the project. + ##### Inviting subgroups to projects in parent groups You can [invite](../members/sharing_projects_groups.md) **Subgroup Y** to **Project A** @@ -159,15 +196,6 @@ graph LR If you do not invite **Subgroup Y** to **Project A**, but make them Code Owners, their approval of the merge request becomes optional. -##### Inviting subgroups to parent groups - -Inviting **Subgroup Y** to a parent group of **Project A** -[is supported](https://gitlab.com/gitlab-org/gitlab/-/issues/498117). When a parent group of Project A invites another group (e.g., Subgroup Y), the invited group is set as a Code Owner. - -NOTE: -For approval to be required, groups as Code Owners should have a direct membership -or inherited membership in the project. - ### Define more specific owners for more specifically defined files or directories When a file or directory matches multiple entries in the `CODEOWNERS` file, -- GitLab From a129057b88d205d191cbdac5d05289da0eb5126a Mon Sep 17 00:00:00 2001 From: Brendan Lynch Date: Wed, 13 Nov 2024 13:06:36 +0000 Subject: [PATCH 3/5] Apply 2 suggestion(s) to 1 file(s) Co-authored-by: Joe Woodward --- doc/user/project/codeowners/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/user/project/codeowners/index.md b/doc/user/project/codeowners/index.md index 265e66a65a30e5..ff6171eac51fdb 100644 --- a/doc/user/project/codeowners/index.md +++ b/doc/user/project/codeowners/index.md @@ -111,7 +111,7 @@ file.md @group-x/subgroup-y file.md @group-x @group-x/subgroup-y ``` -When a group is invited to a parent group, a group higher in your project's hierarchy, +When a group is invited to a parent group higher in your project's hierarchy, it is assigned Code Owner status. For more information, see [Inviting subgroups to parent groups](#inviting-subgroups-to-parent-groups). @@ -144,7 +144,7 @@ The eligible Code Owners are: ##### Inviting subgroups to parent groups -Groups invited to parent groups are now valid Code Owners for subgroups. +Groups invited to parent groups are valid Code Owners for projects within subgroups. Inviting **Subgroup Y** to a parent group of **Project A** [is supported](https://gitlab.com/gitlab-org/gitlab/-/issues/498117). When a parent group of **Project A** invites another group, the invited group is set as a Code Owner. -- GitLab From 874349455629930501e6fcfbdfc175d641748d90 Mon Sep 17 00:00:00 2001 From: Brendan Date: Wed, 13 Nov 2024 15:01:47 +0100 Subject: [PATCH 4/5] Explain that two conditions must be met --- doc/user/project/codeowners/index.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/user/project/codeowners/index.md b/doc/user/project/codeowners/index.md index ff6171eac51fdb..98846220bb65ee 100644 --- a/doc/user/project/codeowners/index.md +++ b/doc/user/project/codeowners/index.md @@ -112,8 +112,8 @@ file.md @group-x @group-x/subgroup-y ``` When a group is invited to a parent group higher in your project's hierarchy, -it is assigned Code Owner status. For more information, -see [Inviting subgroups to parent groups](#inviting-subgroups-to-parent-groups). +and added to the `CODEOWNERS` file, that group becomes a Code Owner for all subgroups. +For more information, see [Inviting subgroups to parent groups](#inviting-subgroups-to-parent-groups). NOTE: You cannot set a member of a group or subgroup as a Code Owner if [Global SAML group memberships lock](../../group/saml_sso/group_sync.md#global-saml-group-memberships-lock) is enabled. @@ -142,12 +142,13 @@ The eligible Code Owners are: - **Project A**: the members of **Group X** only, because **Project A** doesn't belong to **Subgroup Y**. - **Project B**: the members of both **Group X** and **Subgroup Y**. -##### Inviting subgroups to parent groups +##### Invite subgroups to parent groups -Groups invited to parent groups are valid Code Owners for projects within subgroups. +Groups invited to parent groups are valid Code Owners for projects in subgroups. Inviting **Subgroup Y** to a parent group of **Project A** [is supported](https://gitlab.com/gitlab-org/gitlab/-/issues/498117). -When a parent group of **Project A** invites another group, the invited group is set as a Code Owner. +When a parent group of **Project A** invites another group, the invited group is Code Owner eligible. +You must also add the group to the `CODEOWNERS` file to make it a Code Owner. The following is an example of how this works in a multi-level group structure: @@ -175,10 +176,12 @@ NOTE: To require approvals, Code Owners groups must have a direct membership or inherited membership in the project. -##### Inviting subgroups to projects in parent groups +##### Invite subgroups to projects in parent groups You can [invite](../members/sharing_projects_groups.md) **Subgroup Y** to **Project A** -so that their members also become eligible Code Owners. +to make it Code Owner eligible. You must also add the group to the `CODEOWNERS` file to make it a Code Owner. + +Here is an example of subgroup inheritance in a multi-level group structure: ```mermaid %%{init: { "fontFamily": "GitLab Sans" }}%% @@ -193,8 +196,8 @@ graph LR F -.-> |Add Subgroup Y
as Code Owners to Project A| J[Approvals can only
be optional] -.-> B ``` -If you do not invite **Subgroup Y** to **Project A**, but make them Code Owners, their approval -of the merge request becomes optional. +If you do not invite **Subgroup Y** to **Project A**, but add it to the `CODEOWNERS` file, +the group's approval of the merge request is optional. ### Define more specific owners for more specifically defined files or directories -- GitLab From 29ff831146e2261cd5ab2c86273feaabfcc8bbb2 Mon Sep 17 00:00:00 2001 From: Brendan Date: Wed, 13 Nov 2024 15:02:28 +0100 Subject: [PATCH 5/5] Update and fix reference link --- doc/user/project/codeowners/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user/project/codeowners/index.md b/doc/user/project/codeowners/index.md index 98846220bb65ee..d30f51d5bbe4a9 100644 --- a/doc/user/project/codeowners/index.md +++ b/doc/user/project/codeowners/index.md @@ -113,7 +113,7 @@ file.md @group-x @group-x/subgroup-y When a group is invited to a parent group higher in your project's hierarchy, and added to the `CODEOWNERS` file, that group becomes a Code Owner for all subgroups. -For more information, see [Inviting subgroups to parent groups](#inviting-subgroups-to-parent-groups). +For more information, see [Inviting subgroups to parent groups](#invite-subgroups-to-parent-groups). NOTE: You cannot set a member of a group or subgroup as a Code Owner if [Global SAML group memberships lock](../../group/saml_sso/group_sync.md#global-saml-group-memberships-lock) is enabled. -- GitLab