Setting up integration at global level

Setting up GitLab and SonarQube for integration at the global level.

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

You must configure your SonarQube Server base URL in SonarQube Server, otherwise, integration features will not work correctly. See 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 Sensitive settings for more information.

Setting up the import of GitLab repositories

With this setup, users will be able to Importing your 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.

With SonarQube Server Enterprise, you can integrate SonarQube Server with multiple GitLab instances, each instance being accessed with a different GitLab Configuration. For more information, see Feature comparison table.

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 Setting up authentication.

Last updated

Was this helpful?