Open In App

How To Create And Manage GitLab Groups?

Last Updated : 25 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

GitLab is a powerful platform that enables teams to collaborate on code, manage CI/CD pipelines, and track project progress. For organizations with multiple projects, effective project organization and access control are important. GitLab Groups help you organize related projects under a single entity and manage permissions for multiple users across multiple projects more easily.

In this article, we’ll cover how to create and manage GitLab groups, and how to use them to streamline collaboration and control.

Introduction to GitLab Groups

A GitLab Group is a top-level organizational unit in GitLab that lets you manage multiple related projects and repositories under one umbrella. Instead of handling permissions and settings for each project separately, you can manage them collectively within a group. Groups simplify collaboration and administrative tasks when managing larger teams or related projects.

Key Features of GitLab Groups

  • Consolidated project organization
  • Unified permissions for multiple projects
  • Group-level CI/CD templates and configurations
  • Subgroup support for hierarchical project structures

Benefits of Using GitLab Groups

  • Centralized Access Control: You can assign permissions to users at the group level, which automatically propagates to all the projects within the group. This simplifies user management and ensures consistent access control across multiple projects.
  • Efficient Project Organization: Groups help to logically organize related projects, making it easier to locate, manage, and collaborate across multiple repositories.
  • Group-Level CI/CD Pipelines: With group-level configuration, CI/CD pipelines can be shared and applied across all projects in the group, reducing redundancy and ensuring consistent deployment workflows.
  • Subgroups for Hierarchical Structure: Large organizations can create subgroups to further divide their groups into smaller teams or departments, each with its own projects and permissions.
  • Group-Level Security and Compliance: Security settings and compliance policies can be enforced at the group level, providing a centralized way to secure multiple projects.

Steps to Create a GitLab Group

Creating a GitLab group is simple, and once it’s set up, you can start adding projects and members. Follow these steps:

Step 1: Navigate to the Groups Section

  • Log in to your GitLab account.
  • In the top navigation bar, click on Groups.
  • From the dropdown menu, click Your groups to view your existing groups or create a new one.

Step 2: Create a New Group

  • On the Your Groups page, click the New group button.
  • Fill in the details for your group:
    • Group name: This is the name of your group (e.g., "DevOps Team").
    • Group URL: GitLab will generate this automatically based on the group name.
    • Group visibility: Choose between Private, Internal, or Public. Group visibility controls who can see your group and its projects.
  • Click Create group.
    • You now have a group where you can add projects, members, and configure settings.

Manage Projects within a Group

Once a group is created, you can add new or existing projects to it. Here’s how:

Adding a New Project to the Group:

  • Navigate to your group by clicking on Groups in the top menu and selecting the desired group.
  • Click on the New project button.
  • Follow the prompts to create a new project, and ensure the project is assigned to the correct group by selecting the group name during project creation.

Moving an Existing Project to a Group:

  • Go to the project’s homepage.
  • In the project settings, navigate to General > Advanced.
  • Under the Transfer project section, enter the group name and confirm the transfer.

The project will now be moved to the selected group and inherit group-level settings and permissions.

Managing Group Members and Permissions

Managing user access and permissions in a GitLab group is straightforward. You can add members to the group and assign them roles that dictate what they can do.

Step 1: Adding Members to a Group

  • Navigate to your group.
  • Click Group settings > Members.
  • Click the Invite members button.
  • Enter the email address or username of the user you want to add.
  • Assign the appropriate role:
    • Guest: Read-only access to projects.
    • Reporter: Can view issues, merge requests, and pipelines.
    • Developer: Can push code and access pipelines.
    • Maintainer: Can manage settings, push code, and approve merge requests.
    • Owner: Full administrative access to the group.

Step 2: Managing Member Permissions

You can adjust member permissions at any time. Navigate to the Members section and change the role of any user as needed. Group-level permissions cascade to all projects under the group unless overridden at the project level.

Subgroups: Organizing Larger Teams and Projects

Subgroups allow you to create a hierarchical structure within a GitLab group. They are ideal for organizing large teams or departments under a single umbrella while still separating projects and members.

To Create a Subgroup:

  • Navigate to your group.
  • Click Subgroups in the left sidebar.
  • Click New subgroup and follow the same steps used for creating a regular group.
  • Add projects and members specific to the subgroup.

Subgroups inherit permissions and visibility from the parent group but can have separate projects and settings.

Setting Up Group-Level CI/CD Pipelines

Group-level CI/CD allows you to define CI/CD templates and configurations that apply to all projects in the group.

Step 1: Create a Group-Level .gitlab-ci.yml Template

  • Navigate to your group’s Settings.
  • Click CI/CD.
  • Under CI/CD Configuration, create a group-wide .gitlab-ci.yml template. This file will be used by all projects within the group unless they have their own specific configuration.

Step 2: Set Up CI/CD Variables

You can also set up CI/CD variables at the group level, which are automatically available in all group projects. This is useful for setting environment variables, API keys, or other sensitive information.

Integrating Group-Level Security Policies

GitLab allows you to implement security policies at the group level. This includes enforcing branch protection, code quality checks, and security scanning across all projects within a group.

Enforcing Security Settings:

  • Navigate to Group Settings > Repository.
  • Enable Protected Branches for all projects.
  • Set up security checks like Static Application Security Testing (SAST) and Dynamic Application Security Testing (DAST) at the group level under Security & Compliance settings.

Managing Group Settings and Customization

Group settings allow you to further customize your group’s behavior and visibility.

Key Group Settings:

  • General Settings: Manage group visibility, description, and avatar.
  • Permissions: Control default branch protection and group permissions.
  • Integrations: Add integrations (e.g., Slack, Jira) at the group level.
  • Webhooks: Set up webhooks that trigger events for all projects in the group.

Next Article
Article Tags :

Similar Reads