Importing a GitLab group
When you import a GitLab group to SonarQube Cloud, the corresponding organization is created in SonarQube Cloud and is bound to the DevOps platform organization: each SonarQube Cloud organization corresponds one-to-one with a GitLab group.
- You can import your personal GitLab group. This group refers to the repositories that are under your personal namespace.
- You can only import GitLab parent groups. Subgroups are not supported.
The user account you used for the import is automatically assigned to the organization’s Owners group which grants you administration rights on the organization.
Prerequisites
You must be an owner of the GitLab group to be imported.
Step 1: Create a GitLab personal access token
SonarQube Cloud uses a GitLab user account to import your GitLab organization and repositories. You must provide a personal access token from this account (the personal access token will be stored in the respective SonarQube Cloud organization). We highly recommend that you use a dedicated technical user account in GitLab (the account must be an owner of the GitLab group).
For the token, an api
scope is required. This gives SonarQube Cloud more access rights than strictly necessary, but due to the lack of more fine-grained access control in GitLab, it is the only viable option. Note that:
- Using a technical user account to create the token will mitigate this potential security concern.
- SonarQube Cloud will always limit its actions to those required for effective integration with GitLab and will never use the full access right provided by the
api
scope.
To create a GitLab personal access token:
- Log in to GitLab (with the technical account mentioned above if applicable).
- Go to User settings > Personal Access Tokens (or select the Personal Access Token hyperlink).
- Select the api scope.
- Select the Create personal access token button.
- When the personal access token is displayed at the top of the page, copy the token (you will have to paste it into the field on the SonarQube Cloud setup page in Step 3 below).
If you need to change the personal access token stored in the SonarQube Cloud organization, see Changing organization settings.
Step 2: Retrieve the GitLab group key
If you want to import a GitLab group that is not your personal GitLab group, you will have to provide a group key. You can provide:
- Either the ID of the group.
The group ID can be found under the group name on the group page. - Or the key of the group.
The group key is the last element in the path of the group and is found in the URL.
For example,gitlab.com/my-group
.
Step 3: Import the GitLab group
To import a GitLab group to SonarQube Cloud:
- Log in to SonarQube Cloud with any DevOps platform account or your SAML SSO account. If you don't use your GitLab account, see Importing organizations from multiple DevOps platforms for important insights.
- At the top right of the SonarQube Cloud interface, select the ✚ (plus) menu and select Create new organization. The Create an organization page opens.
- Under Import from a DevOps platform, select the GitLab button.
- Select either
- Import any GitLab group, if you want to import a GitLab group other than your personal one, or
- Import my personal GitLab group, if you want to import only the repositories that are under your personal namespace.
- In GitLab group key (if you don't import your personal GitLab group), enter the group key retrieved in Step 2.
- In Personal Access Token, paste the personal access token you created in Step 1.
- Select Continue.
- In Import organization details, SonarQube Cloud suggests a Name and Key for your SonarQube Cloud organization. The key is unique across all organizations within SonarQube Cloud. You can accept the suggestion or change it manually. The interface will prevent you from changing it to an already existing key.
- Select Add additional info to add:
- An avatar: a small image representing the organization and displayed on the UI near the organization name.
- A description of the organization.
- A URL: the URL of the homepage of the organization displayed on the UI.
- In Choose a plan, select the subscription plan for your organization.
- If you selected a paid plan, select the number of Lines of Code (LOC) for your plan and follow the instructions to enter your billing and payment information.
- Select Create Organization. The organization is created and opened in SonarQube Cloud.
Related pages
- Importing a GitHub organization or your personal account
- Importing a Bitbucket Cloud workspace
- Importing an Azure DevOps organization
- Importing organizations from multiple DevOps platforms using the same account
- Creating an organization manually
- Binding an unbound organization
- Changing the organization settings
- Deleting an organization
Was this page helpful?