Skip to main content

Bitbucket

CatalogGitOpsScorecards

Summary

Bitbucket is a Git-based VCS from Atlassian. You can use Bitbucket to drive insights into values such as:

  • Repository details in the Catalog
  • Scorecard rules

The Bitbucket integration can also be used to power Cortex with GitOps.

Setup

Bitbucket Cloud

When using Bitbucket Cloud, you can use our official Bitbucket App, which can be found under Settings → Bitbucket.

caution

If you do not see the Settings page you're looking for in the sidebar, you likely don't have the proper permissions and need to contact your admin.

Bitbucket Server and Data Center

caution
If you're using a self-hosted instance of Bitbucket, you'll need to verify that your Cortex instance is able to reach the Bitbucket instance.
We route our requests through a static IP address. Reach out to support at help@cortex.io to receive details about our static IP. If you're unable to directly whitelist our static IP, you can route requests through a secondary proxy in your network that has this IP whitelisted, and have that proxy route traffic to your Bitbucket instance.

Basic authentication

If running a self-hosted Bitbucket instance, you can use basic auth to connect to Bitbucket. Add your Bitbucket host, username, and password under Settings → Bitbucket by selecting On-Prem (Basic Auth) in the dropdown.

We recommend setting up a bot account that has the desired access levels for the user.

OAuth authentication

If running a self-hosted Bitbucket instance (requires Bitbucket Server or Data Center version 7.20 or higher) you can also use OAuth to connect to Bitbucket. In order to do so, you will need to follow these steps to set up an application link:

  • In your Bitbucket server go to the Settings -> System -> Application Links -> Create Link
  • For the application type pick "External Application" and for the direction select "Incoming"
  • For the redirect url, put in the url of your cortex instance + /oauth/internal/bitbucket
  • For the Permission, select "Projects: Admin" and click save
  • Copy the client ID and client secret for the created link

Once the link is created, add your Bitbucket host, client ID, and client secret under Settings → Bitbucket by selecting On-Prem (OAuth) in the dropdown and filling out the form.

Registration

Catalog descriptor

x-cortex-git:
bitbucket:
repository: <workspace>/<repo>

The value for repository should be the workspace/repo as defined in Bitbucket.

Troubleshooting

  1. Rules are failing saying that I don't have file x, but it's definitely there!
    1. We always use the default branch for file existence checks. Make sure that the file is present in the default branch.