Bitbucket Server and Bitbucket Data Center integration
SonarQube's integration with Bitbucket Server or Bitbucket Data Center allows you to maintain code quality and security in your Bitbucket Server / Data Center repositories.
With this integration, you'll be able to:
- Import your BitBucket Community Build or Data Center repositories: Import your Bitbucket Server or Data Center repositories into SonarQube to easily set up SonarQube projects.
With SonarQube Server, you can in addition:
- Benefit from the pull request analysis and from the analysis of any branch (not only the main one). The integration with Bitbucket Server or Data Center allows you to report your quality gate status to your pull requests, and to prevent pull request merges when the quality gate fails.
- Integrate your SonarQube instance with multiple DevOps platform instances.
For more information, see the SonarQube Server documentation.
Prerequisites
You've set a SonarQube Community Build base URL in SonarQube Community Build: see Configuring the SonarQube Community Build base URL.
Importing your Bitbucket Server repositories into SonarQube Community Build
Setting up the import of BitBucket Server or Data Center repositories into SonarQube Community Build allows you to easily create SonarQube Community Build projects from your Bitbucket Server or Data Center repositories.
To set up the import of BitBucket Server or Data Center repositories:
- Set your global DevOps Platform integration settings
- Add a personal access token for importing repositories
Setting your global DevOps platform integration settings
To set your global DevOps Platform Integration settings, navigate to Administration > Configuration > General Settings > DevOps Platform Integrations, select the Bitbucket tab, and select Bitbucket Server as the variant you want to configure. From here, specify the following settings:
- Bitbucket Server URL: your Server or Data Center instance URL. For example,
https://bitbucket-server.your-company.com
. - Personal Access Token: A Bitbucket Server or Data Center user account for the integration. We recommend using a dedicated Bitbucket Server / Data Center account with Administrator permissions. You need a Personal Access Token from this account with Read permission for the repositories that will be analyzed. Administrators can encrypt this token: see Encrypting sensitive settings for more information.
Adding a personal access token for importing repositories
After setting your global settings, you can add a project from Bitbucket Server or Data Center by clicking the Add project button in the upper-right corner of the Projects homepage and selecting Bitbucket.
Then, you'll be asked to provide a personal access token from your user account with Read
permissions for both projects and repositories. This token will be stored in SonarQube Community Build and can be revoked at any time in Bitbucket Server or Data Center.
After saving your personal access token, you'll see a list of your Bitbucket Server or Data Center projects that you can set up and add to SonarQube Community Build.
Was this page helpful?