Configuring Bitbucket Cloud project binding
Setting up Bitbucket Cloud integration features for your project in SonarQube Cloud.
Once your Bitbucket Cloud workspace has been imported to SonarQube Cloud, you can create your SonarQube Cloud project by importing your Bitbucket Cloud repository. The created SonarQube Cloud project is bound to its Bitbucket Cloud repository, see Binding with the DevOps platform for more details. 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 Bitbucket Cloud 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 Analysis parameters for more details.
See Prerequisites for CI-based analysis for additional information.

Preventing the pull request merge if the quality gate fails
If you use Bitbucket Pipelines, see Bitbucket Pipelines for more details. Otherwise, proceed as described below.
If you know how many builds you have for a pull request, you can run your SonarQube Server analysis and not block the pipeline waiting for results. The SonarQube Server Quality Gate will appear in the build for your PR after the analysis results are available.

You can set the Minimum number of successful builds for the last commit with no failed builds and no in progress in Bitbucket, to the number of builds that run for the pull request.
The blocking of pull requests on quality gate failure is not supported for projects on a monorepo.
Reporting analysis metrics in the Bitbucket repository overview
For a bound project, the analysis metrics of the main branch are reported in the Bitbucket repository overview, see In your DevOps platform for more information. To enable this feature, you must enable the Repository Overview widget.

Enabling the Repository Overview Widget
In Bitbucket Cloud, retrieve your project.
Go to Your Repository > Repository settings > SonarQube Cloud > Settings.
Select Show repository overview widget.

If you don’t see the widget with quality information, make sure that your browser is not using some extensions like AdBlocks. They tend to break the integration of third-party applications in Bitbucket Cloud.
The Repository Overview always shows the status for the main branch, even if you select another branch. This is a limitation of the current integration with Bitbucket.
Related pages
Last updated
Was this helpful?

