GitLab

With a bound project, SonarQube Cloud offers numerous analysis reporting features that are supported in GitLab. This page explains how to set them up.

Once your GitLab group has been imported to SonarQube Cloud, you can create your SonarQube Cloud project by importing your GitLab repository. The created SonarQube Cloud project is bound to its GitLab repository. To bind an unbound project, see Binding an unbound project to a repository.

Setting up pull request integration

For a bound project, the quality gate status and analysis metrics are reported to your pull requests in GitLab provided:

  • Your build script is configured to build on pull request creation and push.

  • If you don't use an integrated CI tool, you must set up the pull request parameters manually, see Pull request analysis for more details.

  • See Prerequisites for CI-based analysis for additional information.

Preventing the pull request merge if the quality gate fails

In GitLab, you can block merge requests if it is failing the quality gate. To do this:

  1. In your GitLab repository, go to Your project > Settings > Merge requests.

  2. In the Merge Checks section, select Pipelines must succeed. More information about GitLab’s External status checks can be found in the GitLab Documentation.

  3. Set up the pipeline to fail. It depends on your CI tool:

The blocking of pull requests on quality gate failure is not supported for projects on a monorepo.

Last updated

Was this helpful?