# Configuring Bitbucket Cloud project binding

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-dop](https://docs.sonarsource.com/sonarqube-cloud/administering-sonarcloud/about-sonarqube-cloud-solution/resources-structure/binding-with-dop "mention") for more details. To bind an unbound project, see [#binding-an-unbound-project-to-a-repository](https://docs.sonarsource.com/sonarqube-cloud/managing-your-projects/changing-binding#binding-an-unbound-project-to-a-repository "mention").

## 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 [#pull-request-analysis](https://docs.sonarsource.com/sonarqube-cloud/analyzing-source-code/analysis-parameters#pull-request-analysis "mention") for more details.
* See [#prerequisites-for-ci-based-analysis](https://docs.sonarsource.com/sonarqube-cloud/analyzing-source-code/pull-request-analysis#prerequisites-for-ci-based-analysis "mention") for additional information.

<div align="left"><figure><img src="https://2223713658-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB4UT2GNiZKjtxFtcFAL7%2Fuploads%2Fgit-blob-0174673c848e7eabd9560c201f0df724c5cba410%2F5c64a6eec8d031b70f038f375c35c42d013b790c.png?alt=media" alt="The status of your SonarQube Cloud project&#x27;s quality gate can be displayed in the Bitbucket Cloud quality gate widget."><figcaption></figcaption></figure></div>

<details>

<summary>Preventing the pull request merge if the quality gate fails</summary>

If you use Bitbucket Pipelines, see [bitbucket-pipelines-for-sonarcloud](https://docs.sonarsource.com/sonarqube-cloud/analyzing-source-code/ci-based-analysis/bitbucket-pipelines-for-sonarcloud "mention") 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.

<div align="left"><figure><img src="https://2223713658-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB4UT2GNiZKjtxFtcFAL7%2Fuploads%2Fgit-blob-644bda1fa5f204e3120b45f5475db84f7433a539%2F4cb6a2361aad47b293413023097e111f34bee2af.png?alt=media" alt="Define the number of builds to pass in Bitbucket Cloud before allowing pull requests to pass your SonarQube Cloud quality gate."><figcaption></figcaption></figure></div>

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.

{% hint style="info" %}
The blocking of pull requests on quality gate failure is not supported for projects on a monorepo.
{% endhint %}

</details>

## Reporting analysis metrics in the Bitbucket repository overview <a href="#reporting-analysis-metrics" id="reporting-analysis-metrics"></a>

For a bound project, the analysis metrics of the main branch are reported in the Bitbucket repository overview, see [#viewing-the-issues-detected-on-a-pull-request](https://docs.sonarsource.com/sonarqube-cloud/issues/in-devops-platform#viewing-the-issues-detected-on-a-pull-request "mention") for more information.\
To enable this feature, you must enable the Repository Overview widget.

<div align="left"><figure><img src="https://2223713658-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB4UT2GNiZKjtxFtcFAL7%2Fuploads%2Fgit-blob-8437bba6a887226b635b4ba160202a892029c5c8%2Fab861af378f891a1c820cc9b9681ce9da5358e75.png?alt=media" alt="Screenshot of the Bitbucket interface with the SonarQube Cloud project analysis results widget."><figcaption></figcaption></figure></div>

<details>

<summary>Enabling the Repository Overview Widget</summary>

1. In Bitbucket Cloud, retrieve your project.
2. Go to *Your Repository* > **Repository settings** > **SonarQube Cloud** > **Settings.**
3. Select **Show repository overview widget.**

<div align="left"><figure><img src="https://2223713658-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB4UT2GNiZKjtxFtcFAL7%2Fuploads%2Fgit-blob-554802593233bb40fd04d2a7151c3f79a7698d66%2F291c0749b3ebc96dd8309d737846057a0793382a.png?alt=media" alt="There is a checkbox in the Bitbucket interface that will enable the analysis overview widget coming from SonarQube Cloud."><figcaption></figcaption></figure></div>

{% hint style="info" %}

* 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.
  {% endhint %}

</details>

## Related pages <a href="#related-pages" id="related-pages"></a>

* [bitbucket-cloud](https://docs.sonarsource.com/sonarqube-cloud/getting-started/bitbucket-cloud "mention")
* [importing-bitbucket-workspace](https://docs.sonarsource.com/sonarqube-cloud/administering-sonarcloud/managing-organization/creating-organization/importing-bitbucket-workspace "mention")
* [bitbucket-pipelines-for-sonarcloud](https://docs.sonarsource.com/sonarqube-cloud/analyzing-source-code/ci-based-analysis/bitbucket-pipelines-for-sonarcloud "mention")
* [setting-up-project](https://docs.sonarsource.com/sonarqube-cloud/managing-your-projects/administering-your-projects/setting-up-project "mention")
* [setting-permissions](https://docs.sonarsource.com/sonarqube-cloud/managing-your-projects/administering-your-projects/setting-permissions "mention")
* [changing-binding](https://docs.sonarsource.com/sonarqube-cloud/managing-your-projects/administering-your-projects/changing-binding "mention")
* [customizing-info-page](https://docs.sonarsource.com/sonarqube-cloud/managing-your-projects/administering-your-projects/customizing-info-page "mention")
* [deleting-project](https://docs.sonarsource.com/sonarqube-cloud/managing-your-projects/administering-your-projects/deleting-project "mention")
* [in-devops-platform](https://docs.sonarsource.com/sonarqube-cloud/managing-your-projects/issues/in-devops-platform "mention")
