Setting up Bitbucket Cloud integration at global level
How to set up Bitbucket Cloud and SonarQube Community Build for integration at the global level.
This section explains how to set up Bitbucket Cloud and SonarQube to allow users to import Bitbucket Cloud repositories. To perform this setup, you need the global Administer System permission in SonarQube.
You can also open the DevOps Platform Integrations page from Administration > Project coverage. See the Project coverage page.
Prerequisites
You’ve set a SonarQube Community Build base URL in SonarQube Community Build: see Server base URL.
Step 1: Create your OAuth client
SonarQube Community Build uses a dedicated OAuth client to access your Bitbucket Cloud workspace. When you create your OAuth client, Bitbucket Cloud generates a client ID and a secret that you need in Step 2.
Proceed as follows:
In your Bitbucket Cloud workspace settings, create an OAuth client and specify the following:
On the Details tab, Name: The name of your OAuth client.
On the Authorization tab, Supported grant types: Select Client credentials. SonarQube Community Build does not use the Authorization code or Refresh token grant types, so you do not need a callback URL.
On the Scopes tab: Grant Read access for the Pull requests permission.
Retrieve the client ID and secret of your OAuth client in your Bitbucket Cloud workspace settings under OAuth clients. You need them in Step 2. If you want to enter the secret in SonarQube Community Build in encrypted format, you can encrypt this secret.
See Sensitive settings for more information about settings encryption.
Step 2: Create a Bitbucket Cloud configuration record
This integration is performed through a "Bitbucket Cloud Configuration" record, which is used in SonarQube to access the Bitbucket Cloud instance.
To set up a Bitbucket Configuration in SonarQube:
Go to Administration > Configuration > General Settings > DevOps Platform Integrations.
Select the Bitbucket tab and click Create configuration. The Create a configuration dialog opens.
Select Bitbucket Cloud.

Specify the following settings:
Workspace ID: The workspace ID is part of your bitbucket cloud URL
https://bitbucket.org/<workspace-id>/<repository-slug>Client ID: The client ID you retrieved in Step 1.
Client Secret: The secret you retrieved in Step 1.
Related pages
Importing Bitbucket Cloud repositories Adding analysis to Bitbucket pipeline Troubleshooting
Last updated
Was this helpful?

