Bitbucket
Track and resolve bugs faster by using data from your Bitbucket commits.
Install
Sentry owner, manager, or admin permissions, and Bitbucket admin permissions are required to install this integration.
- Navigate to Settings > Integrations > Bitbucket.
If you have the legacy Bitbucket integration installed, use the button next to Bitbucket to Upgrade. If you don't have the legacy Bitbucket integration installed, use the button to Install.
In the resulting modal, click "Add Installation".
A Bitbucket install window should pop up. Select the Bitbucket account you'd like to grant Sentry access to, and click "Grant Access".
On your new Bitbucket instance in Sentry, click "Configure".
Add any repositories from which you want to collect commit data.
Bitbucket should now be enabled for all projects under your Sentry organization.
Bitbucket Server
Generate an RSA public/private key pair
To generate an RSA public/private key pair, run the following commands in your terminal window one by one.
openssl genrsa -out bitbucket_privatekey.pem 1024
openssl req -newkey rsa:1024 -x509 -key bitbucket_privatekey.pem -out bitbucket_publickey.cer -days 365
openssl pkcs8 -topk8 -nocrypt -in bitbucket_privatekey.pem -out bitbucket_privatekey.pcks8
openssl x509 -pubkey -noout -in bitbucket_publickey.cer > bitbucket_publickey.pem
Create a new application link in Bitbucket
In Bitbucket, click the gear icon, then Applications > Application Links.
Enter the following as the application URL:
https://sentry.io/extensions/bitbucket_server/setup/
Click "Create New Link". If you see a warning that “No response was received from the URL you entered,” ignore and click "Continue".
In the resulting dialog, fill out the form as follows:
Application Name Sentry Application Type Generic Application Service Provider Name Sentry Consumer Key (your choice, but keep this handy for the next step) Shared Secret sentry Request Token URL https://sentry.io Access Token URL https://sentry.io Authorize URL https://sentry.io Create Incoming Link No Click "Continue". This will return you to the Configure Application Links page, where you'll see an application called Sentry.
Click the pencil icon next to the Sentry application.
On the lefthand side of the resulting modal, click "Incoming Authentication". Fill out the form as follows, and click "Save":
Consumer Key (the consumer key from Step II.4) Consumer Name Sentry Public Key (the public key you created in Section I) Consumer Callback URL https://sentry.io/extensions/bitbucket_server/setup/ Allow 2-Legged OAuth no
Connect your Bitbucket Server application with Sentry
Note: Confirm Sentry's IP ranges are allowed.
- In Sentry, navigate to Organization Settings > Integrations.
- Next to Bitbucket Server, click "Install".
- In the resulting modal, click "Add Installation".
- In the resulting window, enter the base URL for your Bitbucket Server instance, your consumer key, and your private key. Click "Submit". Then, complete the OAuth process as prompted.
- In Sentry, you’ll see a new Bitbucket Server instance appear on the Integrations page.
Bitbucket should now be authorized for all projects under your Sentry organization.
Configure
Use Bitbucket to track commits, for issue management, and to resolve in commit.
Commit Tracking
Commit tracking allows you to hone in on problematic commits. Uncover which commits likely caused an issue, and allow your team to resolve issues by referencing the issue number in a commit message.
For more details, see the full documentation on commit tracking and releases.
Issue Management
Issue tracking allows you to create Bitbucket issues from within Sentry, and link Sentry issues to existing Bitbucket Issues.
Once you’ve navigated to a specific issue, you’ll find the Linked Issues section on the right hand panel. Here, you’ll be able to create or link Bitbucket issues.
Resolving in Commit
Once you are sending commit data, you can start resolving issues by including fixes <SENTRY-SHORT-ID>
in your commit messages. For example, a commit message might look like:
Prevent empty queries on users
Fixes MYAPP-317
When Sentry sees this, we’ll automatically annotate the matching issue with reference to the commit, and later, when that commit is part of a release, we’ll mark the issue as resolved. The commit must be associated with a release. Otherwise, if the commit is squashed, Sentry won’t know when the commit has been released, and the issue may never be marked as a regression.
Troubleshooting
If you're having trouble setting up Sentry with your on-premises integration, verify the following:
- The provided installation URL is a fully qualified domain name (FQDN), which is resolvable on the internet.
- The IP addresses Sentry uses to make outbound requests are allowed.
- Sentry's access to your installation URL is not path restricted.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").