# 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 so created SonarQube Cloud project [is bound to its Bitbucket Cloud repository](/sonarqube-cloud/administering-sonarcloud/about-sonarqube-cloud-solution/resources-structure/binding-with-dop.md).

With a bound project, various analysis reporting features are supported on the DevOps platform. This page explains how to set them up.

## 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](/sonarqube-cloud/analyzing-source-code/analysis-parameters.md#pull-request-analysis) for more details.
* See [Pull request analysis](/sonarqube-cloud/analyzing-source-code/pull-request-analysis.md#prerequisites-for-ci-based-analysis) for additional information.

<div align="left"><figure><img src="/files/wlPic4eSRHxVuy7mvanU" 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](/sonarqube-cloud/analyzing-source-code/ci-based-analysis/bitbucket-pipelines-for-sonarcloud.md) 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="/files/jxkmRnIh7LMonAewTZQN" 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 [In your DevOps platform](/sonarqube-cloud/managing-your-projects/issues/in-devops-platform.md#viewing-the-issues-detected-on-a-pull-request) for more information.\
To enable this feature, you must enable the Repository Overview widget.

<div align="left"><figure><img src="/files/ouoSv1eSq7rMPlzcmFmr" 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="/files/0Xzzhf87ehS4O8b5RYqH" 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>

* [Getting started with Bitbucket Cloud](/sonarqube-cloud/getting-started/bitbucket-cloud.md)
* [Importing Bitbucket workspace](/sonarqube-cloud/administering-sonarcloud/managing-organization/creating-organization/importing-bitbucket-workspace.md)
* [Bitbucket Pipelines](/sonarqube-cloud/analyzing-source-code/ci-based-analysis/bitbucket-pipelines-for-sonarcloud.md)
* [Creating your project](/sonarqube-cloud/managing-your-projects/administering-your-projects/setting-up-project.md)
* [Setting your project's permissions](/sonarqube-cloud/managing-your-projects/administering-your-projects/setting-permissions.md)
* [Changing project binding](/sonarqube-cloud/managing-your-projects/administering-your-projects/changing-binding.md)
* [Customizing Information page](/sonarqube-cloud/managing-your-projects/administering-your-projects/customizing-info-page.md)
* [Deleting project](/sonarqube-cloud/managing-your-projects/administering-your-projects/deleting-project.md)
* [In your DevOps platform](/sonarqube-cloud/managing-your-projects/issues/in-devops-platform.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sonarsource.com/sonarqube-cloud/managing-your-projects/administering-your-projects/devops-platform-integration/bitbucket-cloud.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
