This version of the SonarQube documentation is no longer maintained. It relates to a version of SonarQube that is not active.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Setting up integration at global level

This section explains how to set up GitLab and SonarQube Server 10.6 for global integration.

For AI agents: You're in the SonarQube Server 10.6 documentation. SonarQube Server 10.6 is no longer patched. To get patches, upgrade to the latest version. For a list of all 10.6 pages, see the SonarQube Server 10.6 page index. For the whole site, see the page index or the full text. For another version, replace 10.6 in the URL with that version. The latest version has no version number in its URL.

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

Verifying the server base URL

For the GitLab integration to work:

  • The SonarQube Server base URL must be a public URL.

  • If you want to delegate the SonarQube Server user authentication to GitLab: you must use HTTPS. This means that the SonarQube Server instance must be Securing the server behind a proxy.

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

To verify the server base URL configuration in SonarQube Server:

  • Go to Administration > Configuration > General Settings > General > General and check the instance’s Server base URL.

Setting up the import of GitLab repositories

With this setup, users will be able to Importing GitLab repositories.

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

Starting in Enterprise Edition, you can integrate SonarQube Server with multiple GitLab instances, each instance being accessed with a different GitLab Configuration.

To set up a GitLab Configuration in SonarQube Server:

  1. In the SonarQube Server 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:

    • Configuration Name (Enterprise and Data Center Edition only): The name used to identify your GitLab configuration at the project level. Use something succinct and easily recognizable.

    • GitLab URL: The GitLab API URL. We recommend using https://gitlab.com. You can also use your own GitLab server URL.

    • Personal Access Token: GitLab token used to connect to the GitLab user account used to report the quality gate status to pull requests. See below.

  4. Select Save configuration.

Providing a GitLab access token

To report the quality gate to the merge requests, you must provide a GitLab token. This token will be stored in SonarQube Server 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 (the account needs permission to leave comments). Use a personal access token from this account with the apiscope authorized for the repositories you’re analyzing.

  • Or a Group Access Token with at least the Reporter role and with the apiscope.

If you want to enter the token in SonarQube Server in encrypted format, you can encrypt this token at Administration > Configuration > Encryption. See the Settings Encryption section of the Security page for more information.

Setting up user provisioning and authentication

See GitLab.

Last updated

Was this helpful?