2019-06-09 19:25:42 -04:00
|
|
|
---
|
|
|
|
type: reference, howto, concepts
|
|
|
|
---
|
|
|
|
|
2017-03-07 15:32:36 -05:00
|
|
|
# Subgroups
|
|
|
|
|
2020-05-21 23:08:28 -04:00
|
|
|
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/2772) in GitLab 9.0.
|
2017-03-07 15:32:36 -05:00
|
|
|
|
2020-03-10 20:09:09 -04:00
|
|
|
GitLab supports up to 20 levels of subgroups, also known as nested groups or hierarchical groups.
|
2019-06-09 19:25:42 -04:00
|
|
|
levels of groups.
|
|
|
|
|
|
|
|
By using subgroups you can do the following:
|
2017-03-07 15:32:36 -05:00
|
|
|
|
|
|
|
- **Separate internal / external organizations.** Since every group
|
|
|
|
can have its own visibility level, you are able to host groups for different
|
|
|
|
purposes under the same umbrella.
|
|
|
|
- **Organize large projects.** For large projects, subgroups makes it
|
|
|
|
potentially easier to separate permissions on parts of the source code.
|
|
|
|
- **Make it easier to manage people and control visibility.** Give people
|
2019-03-05 07:55:30 -05:00
|
|
|
different [permissions](../../permissions.md#group-members-permissions) depending on their group [membership](#membership).
|
2017-03-07 15:32:36 -05:00
|
|
|
|
2020-06-29 17:09:07 -04:00
|
|
|
For more information on allowed permissions in groups and projects, see
|
|
|
|
[visibility levels](../../../development/permissions.md#general-permissions).
|
|
|
|
|
2017-03-07 15:32:36 -05:00
|
|
|
## Overview
|
|
|
|
|
|
|
|
A group can have many subgroups inside it, and at the same time a group can have
|
2020-07-02 17:09:14 -04:00
|
|
|
only one immediate parent group. It resembles a directory behavior or a nested items list:
|
2017-03-07 15:32:36 -05:00
|
|
|
|
2017-03-14 16:41:46 -04:00
|
|
|
- Group 1
|
|
|
|
- Group 1.1
|
|
|
|
- Group 1.2
|
2019-07-21 21:49:37 -04:00
|
|
|
- Group 1.2.1
|
|
|
|
- Group 1.2.2
|
|
|
|
- Group 1.2.2.1
|
2017-03-07 15:32:36 -05:00
|
|
|
|
|
|
|
In a real world example, imagine maintaining a GNU/Linux distribution with the
|
2019-06-09 19:25:42 -04:00
|
|
|
first group being the name of the distribution, and subsequent groups split as follows:
|
2017-03-07 15:32:36 -05:00
|
|
|
|
2017-03-14 16:41:46 -04:00
|
|
|
- Organization Group - GNU/Linux distro
|
|
|
|
- Category Subgroup - Packages
|
2019-07-21 21:49:37 -04:00
|
|
|
- (project) Package01
|
|
|
|
- (project) Package02
|
2017-03-14 16:41:46 -04:00
|
|
|
- Category Subgroup - Software
|
2019-07-21 21:49:37 -04:00
|
|
|
- (project) Core
|
|
|
|
- (project) CLI
|
|
|
|
- (project) Android app
|
|
|
|
- (project) iOS app
|
2017-03-14 16:41:46 -04:00
|
|
|
- Category Subgroup - Infra tools
|
2019-07-21 21:49:37 -04:00
|
|
|
- (project) Ansible playbooks
|
2017-03-07 15:32:36 -05:00
|
|
|
|
|
|
|
Another example of GitLab as a company would be the following:
|
|
|
|
|
2017-03-14 16:41:46 -04:00
|
|
|
- Organization Group - GitLab
|
2018-04-27 04:50:05 -04:00
|
|
|
- Category Subgroup - Marketing
|
2019-07-21 21:49:37 -04:00
|
|
|
- (project) Design
|
|
|
|
- (project) General
|
2017-03-14 16:41:46 -04:00
|
|
|
- Category Subgroup - Software
|
2019-07-21 21:49:37 -04:00
|
|
|
- (project) GitLab CE
|
|
|
|
- (project) GitLab EE
|
|
|
|
- (project) Omnibus GitLab
|
|
|
|
- (project) GitLab Runner
|
|
|
|
- (project) GitLab Pages daemon
|
2017-03-14 16:41:46 -04:00
|
|
|
- Category Subgroup - Infra tools
|
2019-07-21 21:49:37 -04:00
|
|
|
- (project) Chef cookbooks
|
2017-03-14 16:41:46 -04:00
|
|
|
- Category Subgroup - Executive team
|
2017-03-07 15:32:36 -05:00
|
|
|
|
|
|
|
---
|
|
|
|
|
2019-09-20 02:06:19 -04:00
|
|
|
When performing actions such as transferring or importing a project between
|
|
|
|
subgroups, the behavior is the same as when performing these actions at the
|
|
|
|
`group/project` level.
|
2017-03-07 15:32:36 -05:00
|
|
|
|
|
|
|
## Creating a subgroup
|
|
|
|
|
2019-07-19 14:22:09 -04:00
|
|
|
To create a subgroup you must either be an Owner or a Maintainer of the
|
|
|
|
group, depending on the group's setting.
|
|
|
|
|
|
|
|
By default, groups created in:
|
|
|
|
|
|
|
|
- GitLab 12.2 or later allow both Owners and Maintainers to create subgroups.
|
|
|
|
- GitLab 12.1 or earlier only allow Owners to create subgroups.
|
|
|
|
|
|
|
|
This setting can be for any group by an Owner or Administrator.
|
2019-07-03 12:43:56 -04:00
|
|
|
|
|
|
|
For more information check the
|
|
|
|
[permissions table](../../permissions.md#group-members-permissions). For a list
|
|
|
|
of words that are not allowed to be used as group names see the
|
2019-03-05 07:55:30 -05:00
|
|
|
[reserved names](../../reserved_names.md).
|
2019-07-03 01:55:20 -04:00
|
|
|
|
2019-07-03 12:43:56 -04:00
|
|
|
Users can always create subgroups if they are explicitly added as an Owner (or
|
2020-07-02 17:09:14 -04:00
|
|
|
Maintainer, if that setting is enabled) to an immediate parent group, even if group
|
2019-07-03 12:43:56 -04:00
|
|
|
creation is disabled by an administrator in their settings.
|
2017-03-07 15:32:36 -05:00
|
|
|
|
|
|
|
To create a subgroup:
|
|
|
|
|
2018-01-31 14:32:35 -05:00
|
|
|
1. In the group's dashboard expand the **New project** split button, select
|
|
|
|
**New subgroup** and click the **New subgroup** button.
|
2017-03-07 15:32:36 -05:00
|
|
|
|
2019-07-21 21:49:37 -04:00
|
|
|
![Subgroups page](img/create_subgroup_button.png)
|
2017-03-07 15:32:36 -05:00
|
|
|
|
2020-07-02 17:09:14 -04:00
|
|
|
1. Create a new group like you would normally do. Notice that the immediate parent group
|
2017-03-07 15:32:36 -05:00
|
|
|
namespace is fixed under **Group path**. The visibility level can differ from
|
2020-07-02 17:09:14 -04:00
|
|
|
the immediate parent group.
|
2017-03-07 15:32:36 -05:00
|
|
|
|
2019-07-21 21:49:37 -04:00
|
|
|
![Subgroups page](img/create_new_group.png)
|
2017-03-07 15:32:36 -05:00
|
|
|
|
|
|
|
1. Click the **Create group** button and you will be taken to the new group's
|
|
|
|
dashboard page.
|
|
|
|
|
2017-09-21 09:39:18 -04:00
|
|
|
Follow the same process to create any subsequent groups.
|
2017-03-07 15:32:36 -05:00
|
|
|
|
|
|
|
## Membership
|
|
|
|
|
|
|
|
When you add a member to a subgroup, they inherit the membership and permission
|
2020-07-02 17:09:14 -04:00
|
|
|
level from the parent group(s). This model allows access to nested groups if you
|
2017-03-07 15:32:36 -05:00
|
|
|
have membership in one of its parents.
|
|
|
|
|
2020-07-02 17:09:14 -04:00
|
|
|
Jobs for pipelines in subgroups can use [Runners](../../../ci/runners/README.md) registered to the parent group(s).
|
|
|
|
This means secrets configured for the parent group are available to subgroup jobs.
|
2019-09-20 02:06:19 -04:00
|
|
|
|
2020-07-02 17:09:14 -04:00
|
|
|
In addition, maintainers of projects that belong to subgroups can see the details of Runners registered to parent group(s).
|
2019-09-20 02:06:19 -04:00
|
|
|
|
2019-06-09 19:25:42 -04:00
|
|
|
The group permissions for a member can be changed only by Owners, and only on
|
2017-03-10 08:15:28 -05:00
|
|
|
the **Members** page of the group the member was added.
|
|
|
|
|
2017-03-07 15:32:36 -05:00
|
|
|
You can tell if a member has inherited the permissions from a parent group by
|
|
|
|
looking at the group's **Members** page.
|
|
|
|
|
|
|
|
![Group members page](img/group_members.png)
|
|
|
|
|
2019-06-09 19:25:42 -04:00
|
|
|
From the image above, we can deduce the following things:
|
2017-03-07 15:32:36 -05:00
|
|
|
|
2019-06-09 19:25:42 -04:00
|
|
|
- There are 5 members that have access to the group `four`.
|
2017-03-10 08:15:28 -05:00
|
|
|
- User0 is a Reporter and has inherited their permissions from group `one`
|
2019-06-09 19:25:42 -04:00
|
|
|
which is above the hierarchy of group `four`.
|
2017-03-07 15:32:36 -05:00
|
|
|
- User1 is a Developer and has inherited their permissions from group
|
2019-06-09 19:25:42 -04:00
|
|
|
`one/two` which is above the hierarchy of group `four`.
|
2017-03-07 15:32:36 -05:00
|
|
|
- User2 is a Developer and has inherited their permissions from group
|
2019-06-09 19:25:42 -04:00
|
|
|
`one/two/three` which is above the hierarchy of group `four`.
|
2017-03-10 08:15:28 -05:00
|
|
|
- For User3 there is no indication of a parent group, therefore they belong to
|
2019-06-09 19:25:42 -04:00
|
|
|
group `four`, the one we're inspecting.
|
2017-03-10 08:15:28 -05:00
|
|
|
- Administrator is the Owner and member of **all** subgroups and for that reason,
|
2019-06-09 19:25:42 -04:00
|
|
|
as with User3, there is no indication of an ancestor group.
|
2017-03-07 15:32:36 -05:00
|
|
|
|
2020-05-21 23:08:28 -04:00
|
|
|
[From](https://gitlab.com/gitlab-org/gitlab/-/issues/21727) GitLab 12.6, you can filter
|
2019-12-13 10:08:02 -05:00
|
|
|
this list using dropdown on the right side:
|
|
|
|
|
|
|
|
![Group members filter](img/group_members_filter_v12_6.png)
|
|
|
|
|
|
|
|
- **Show only direct members** displays only Administrator and User3, since these are
|
|
|
|
the only users that belong to group `four`, which is the one we're inspecting.
|
|
|
|
- **Show only inherited members** displays User0, User1 and User2, no matter which group
|
|
|
|
above the hierarchy is the source of inherited permissions.
|
|
|
|
|
2017-03-10 08:15:28 -05:00
|
|
|
### Overriding the ancestor group membership
|
|
|
|
|
2018-09-21 07:39:05 -04:00
|
|
|
NOTE: **Note:**
|
2019-06-09 19:25:42 -04:00
|
|
|
You must be an Owner of a group to be able to add members to it.
|
2017-03-10 08:15:28 -05:00
|
|
|
|
2018-09-21 07:39:05 -04:00
|
|
|
NOTE: **Note:**
|
2018-09-19 07:22:33 -04:00
|
|
|
A user's permissions in a subgroup cannot be lower than in any of its ancestor groups.
|
|
|
|
Therefore, you cannot reduce a user's permissions in a subgroup with respect to its ancestor groups.
|
|
|
|
|
2017-03-14 16:41:46 -04:00
|
|
|
To override a user's membership of an ancestor group (the first group they were
|
2018-09-19 07:22:33 -04:00
|
|
|
added to), add the user to the new subgroup again with a higher set of permissions.
|
2017-03-10 08:15:28 -05:00
|
|
|
|
2017-03-14 16:41:46 -04:00
|
|
|
For example, if User0 was first added to group `group-1/group-1-1` with Developer
|
2017-03-10 08:15:28 -05:00
|
|
|
permissions, then they will inherit those permissions in every other subgroup
|
2018-05-22 06:16:06 -04:00
|
|
|
of `group-1/group-1-1`. To give them Maintainer access to `group-1/group-1-1/group1-1-1`,
|
|
|
|
you would add them again in that group as Maintainer. Removing them from that group,
|
2017-03-14 16:41:46 -04:00
|
|
|
the permissions will fallback to those of the ancestor group.
|
2017-03-07 15:32:36 -05:00
|
|
|
|
|
|
|
## Mentioning subgroups
|
|
|
|
|
|
|
|
Mentioning groups (`@group`) in issues, commits and merge requests, would
|
2019-06-09 19:25:42 -04:00
|
|
|
notify all members of that group. Now with subgroups, there is more granular
|
2017-03-07 15:32:36 -05:00
|
|
|
support if you want to split your group's structure. Mentioning works as before
|
2017-03-10 08:18:48 -05:00
|
|
|
and you can choose the group of people to be notified.
|
2017-03-07 15:32:36 -05:00
|
|
|
|
|
|
|
![Mentioning subgroups](img/mention_subgroups.png)
|
|
|
|
|
|
|
|
## Limitations
|
|
|
|
|
|
|
|
Here's a list of what you can't do with subgroups:
|
|
|
|
|
2018-12-03 06:05:38 -05:00
|
|
|
- [GitLab Pages](../../project/pages/index.md) supports projects hosted under
|
|
|
|
a subgroup, but not subgroup websites.
|
|
|
|
That means that only the highest-level group supports
|
2019-11-06 13:06:29 -05:00
|
|
|
[group websites](../../project/pages/getting_started_part_one.md#gitlab-pages-default-domain-names),
|
2018-12-03 06:05:38 -05:00
|
|
|
although you can have project websites under a subgroup.
|
2017-03-07 15:32:36 -05:00
|
|
|
- It is not possible to share a project with a group that's an ancestor of
|
|
|
|
the group the project is in. That means you can only share as you walk down
|
|
|
|
the hierarchy. For example, `group/subgroup01/project` **cannot** be shared
|
|
|
|
with `group`, but can be shared with `group/subgroup02` or
|
|
|
|
`group/subgroup01/subgroup03`.
|
|
|
|
|
2019-06-09 19:25:42 -04:00
|
|
|
<!-- ## Troubleshooting
|
|
|
|
|
|
|
|
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
|
|
|
|
one might have when setting this up, or when something is changed, or on upgrading, it's
|
|
|
|
important to describe those, too. Think of things that may go wrong and include them here.
|
|
|
|
This is important to minimize requests for support, and to avoid doc comments with
|
|
|
|
questions that you know someone might ask.
|
|
|
|
|
|
|
|
Each scenario can be a third-level heading, e.g. `### Getting error message X`.
|
|
|
|
If you have none to add when creating a doc, leave this section in place
|
|
|
|
but commented out to help encourage others to add to it in the future. -->
|