Start Free
SonarQube Community Build | DevOps platform integration | GitLab integration | Setting up integration at global level

Setting up the GitLab integration at the global level

On this page

This section explains how to set up GitLab and SonarQube Community Build for global integration. To perform this setup, you need the global Administer System permission in SonarQube Community Build.

Preparing the integration

Verifying the server base URL

For the GitLab integration to work:

  • The SonarQube Community Build base URL must be a public URL.
  • If you want to delegate the SonarQube Community Build user authentication to GitLab: you must use HTTPS. This means that the SonarQube Community Build must be secured behind a proxy.

You must configure your SonarQube Community Build base URL in SonarQube Community Build, otherwise, integration features will not work correctly.

To verify the server base URL configuration in SonarQube Community Build:

  • Go to Administration > Configuration > General Settings > General > General and check the instance's Server base URL
Generating a token

You must provide a GitLab access token that will be used by SonarQube Community Build to import the repositories. This token will be stored in SonarQube Community Build and can be revoked at any time in GitLab.

You can either provide:

  • A personal access token.
    We recommend using a dedicated GitLab account with at least Reporter permissions. Use a personal access token from this account with the api scope authorized for the repositories you're analyzing.
  • Or a Group Access Token with at least the Reporter role and with the api scope. 

If you want to enter the token in SonarQube Community Build in encrypted format, you can encrypt this token. See Encrypting sensitive settings for more information.

Setting up the import of GitLab repositories

With this setup, users will be able to import GitLab repositories into SonarQube Community Build.

This integration is performed through a “GitLab Configuration” record, which is used in SonarQube Community Build to access the GitLab instance. You need the Administration System permission to set up a GitLab Configuration.

To set up a GitLab Configuration in SonarQube Community Build:

  1. In the SonarQube Community Build UI, go to Administration > Configuration > General Settings > DevOps Platform Integrations
  2. Select the GitLab tab and click Create configuration. The Create a configuration dialog opens.
  3. Specify the following settings:
    • GitLab URL: The GitLab API URL. We recommend using https://gitlab.com/api/v4. You can also use your own GitLab server URL.
    • Personal Access Token: GitLab token you created in Preparing the integration above.
  4. Select Save configuration.

Setting up user provisioning and authentication

See GitLab authentication.


Was this page helpful?

© 2008-2025 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARQUBE, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License