Cortex connects to many third-party vendors whose system interfaces frequently change. As a result, integration behavior or configuration steps may shift without notice. If you encounter unexpected issues, check with your system administrator or refer to the vendor’s documentation for the most current information. Additionally, integration sync times vary and are subject to scheduling overrides and timing variance.
- Discover and track ownership of Bitbucket entities
- View Bitbucket data on entity pages in Cortex
- Follow a GitOps workflow with Bitbucket
- View information about pull requests in the engineering homepage
- Use Bitbucket metrics in Eng Intelligence to understand key metrics and gain insight into services, incident response, and more
- Create Scorecards that track progress and drive alignment on projects involving your Bitbucket repositories
Bitbucket data in Eng Intelligence and in the engineering homepage is available in private beta. Please contact your Cortex Customer Success Manager for access.
How to configure Bitbucket with Cortex
There are multiple options for integrating with Bitbucket:- Cloud: Using a workspace token (recommended), the Cortex Atlassian app, or an app password.
- On-prem: Using Basic auth or using OAuth
- You can also integrate using Cortex Axon Relay, a relay broker that allows you to securely connect your on-premises Bitbucket data.
Workspace token
Workspace token
Configure Cortex with Bitbucket using a workspace tokenStep 1: Generate a workspace token in Bitbucket
- In Bitbucket, navigate to Settings > Workspace settings > Access tokens.
- Create a workspace-level access token. Include the following scopes:
Repositories: ReadPull requests: Read
-
In Cortex, navigate to the Bitbucket settings page.
- Click Integrations from the main nav. Search for and select Bitbucket.
-
For the configuration type, select Cloud (workspace token).

-
Configure the form:
- Account alias: Enter an alias for the account. Aliases are used to tie service registrations to different configuration accounts.
- Token: Enter the workspace token you generated in Bitbucket.
- Click Save.
-
On the Bitbucket Settings page in Cortex, next to your integration’s alias, click Add workspace.
-
In the “Workspace configuration” modal, enter your Workspace name.
- You can find this in Bitbucket under Settings > Workspace settings.
- Click Save.
Atlassian App
Atlassian App
Configure Cortex with Bitbucket using the Atlassian appStep 1: Install the Cortex Atlassian appFollow the installation instructions in the Atlassian Marketplace for the Cortex app.Step 2: Configure the integration in Cortex
- In Cortex, navigate to the Bitbucket settings page.
- Click Integrations from the main nav. Search for and select Bitbucket.
- Click Add Bitbucket configuration.
- For the configuration type, select select Atlassian app.

- Configure the “Add Bitbucket configuration” form:
- Account alias: Enter an alias for the account. Aliases are used to tie service registrations to different configuration accounts.
- Click Save.
- You will be redirected to the Bitbucket Settings page in Cortex.
- On the Bitbucket settings page in Cortex, click Atlassian Application.

- In the popup that appears, click Grant access to authorize Cortex access to your Atlassian Workspace.
App password
App password
Configure Cortex with Bitbucket using an app passwordStep 1: Create an app password
- Follow Atlassian’s documentation to create an app password for Bitbucket.
- Make sure to give the app password the following minimum permissions:
Repositories: Admin,Repositories: Read,Pull requests: Read
- In Cortex, navigate to the Bitbucket settings page.
- Click Integrations from the main nav. Search for and select Bitbucket.
- Click Add configuration.
- For the configuration type, select Cloud (basic auth).

- Configure the “Add Bitbucket configuration” form:
- Account alias: Enter an alias for the account. Aliases are used to tie service registrations to different configuration accounts.
- Username: Enter your Bitbucket username.
- You can find this in Bitbucket under Personal settings > Account settings > Bitbucket profile settings.
- Password: Enter the app password you created in the previous steps.
- Click Save.
- You will be redirected to the Bitbucket Settings page.
-
On the Bitbucket Settings page in Cortex, next to your integration’s alias, click Add workspace.
-
In the “Workspace configuration” modal, enter your Workspace name.
- You can find this in Bitbucket under Settings > Workspace settings.
- Click Save.
Basic auth
Basic auth
Configure Cortex with Bitbucket using a on-premises basic authStep 1: Create an app password
- Follow Atlassian’s documentation to create an app password for Bitbucket.
- Make sure to give the app password the following minimum permissions:
Repositories: Admin,Repositories: Read,Pull requests: Read
- In Cortex, navigate to the Bitbucket settings page.
- Click Integrations from the main nav. Search for and select Bitbucket.
- Click Add configuration.
- For the configuration type, select On-prem (basic auth).

- Configure the “Add Bitbucket configuration” form:
- Account alias: Enter an alias for the account. Aliases are used to tie service registrations to different configuration accounts.
- Host: Enter your Bitbucket on-prem host, e.g.,
https://bitbucket.example.com. - Username: Enter your Bitbucket username.
- You can find this in Bitbucket under Personal settings > Account settings > Bitbucket profile settings.
- Password: Enter the app password you created in the previous steps.
- Click Save.
OAuth
OAuth
Configure Cortex with Bitbucket on-premises using OAuthPrerequisitesTo configure this integration with on-prem OAuth, you must be running a self-hosted Bitbucket instance with Bitbucket Server or Data Center version 7.20 or higher.Step 1: Set up an application link in Bitbucket
Scaffolder and Workflow automation are supported with this configuration. See Registering a Scaffolder template for setup details.
- In your Bitbucket server, navigate to Settings > System > Application Links > Create Link.
- Configure the application link:
- For the application type, select “External Application.”
- For the direction, select “Incoming.”
- For the redirect URL:
- Default configuration: Enter the URL of your Cortex instance and
/oauth/internal/bitbucket. - Non-default configuration: Enter the URL of your Cortex instance and
/oauth/internal/bitbucket/{alias}.
- Default configuration: Enter the URL of your Cortex instance and
- For the Permission, select
Projects: AdminandRepositories: Admin.
- Click Save.
- Copy the client ID and client secret. You will need these in the next steps.
-
In Cortex, navigate to the Bitbucket settings page.
- Click Integrations from the main nav. Search for and select Bitbucket.
- Click Add configuration.
-
For the configuration type, select On-prem (OAuth).

-
Configure the “Add Bitbucket configuration” form:
- Account alias: Enter an alias for the account. Aliases are used to tie service registrations to different configuration accounts.
- Host: Enter your Bitbucket on-prem host, e.g.,
https://bitbucket.example.com. - Client ID: Enter the client ID you obtained in the previous steps.
- Client secret: Enter the client secret you obtained in the previous steps.
- Click Save.
Axon Relay
Axon Relay
Configure Bitbucket with Cortex Axon RelaySee Internally hosted integrations for instructions. Make sure to follow the Bitbucket-specific instructions for the docker-compose.yml file.
Scaffolder and Workflow automation are supported when connecting Bitbucket via Axon Relay. See Registering a Scaffolder template for setup details.
Limit which Bitbucket projects are used for the integration
If you are a part of multiple projects in Bitbucket but you only want to show repositories for a specific set of projects, you can specify the projects in Cortex:- Navigate to the Bitbucket integration settings page.
-
Click the pencil icon in the row containing the Bitbucket configuration you want to edit.

-
Under Project names, select which projects you want to include.

- At the bottom of the side panel, click Save.
Use webhooks for GitOps functionality
To use webhooks for GitOps functionality, you need to set a secret token on the Bitbucket Settings page. This helps Cortex identify that the webhook event is valid. Make sure to enter the same secret when configuring the webhook on Bitbucket Server.
How to connect Cortex entities to Bitbucket
Import entities from Bitbucket
See the Create services documentation for instructions on importing entities.Editing the entity descriptor
Set repository details By specifying thex-cortex-git field in your Cortex entity descriptor, you’ll be able to see Git information in the entity page, including the top language, recent commits, and top contributors.
The value for
repository should be the workspace/repo as defined in Bitbucket.
Ownership
You can define the following block in your Cortex entity descriptor to add your Bitbucket teams.
Identity mappings
Cortex maps users’ email addresses to discovered Bitbucket accounts, so you never need to define email ownership in an entity descriptor. You can confirm users’ Bitbucket accounts are connected from Bitbucket identity mappings in settings.Using the Bitbucket integration
View Bitbucket information on entity pages in Cortex
The Bitbucket integration populates the Repository block on an entity’s details page. For cloud configurations, it also populates the Language block. If a Bitbucket team has been defined as the owner for an entity, it will also appear in the Owners block.
Events
On an entity’s Events page, you can find all of the commits and releases associated with that entity. Each is hyperlinked to the commit or release page in Bitbucket and includes a timestamp.CI/CD
To see pipeline runs for Bitbucket, use the deploys API to add deploy information. After doing this, from the CI/CD > Deploys page in the entity’s sidebar, you will see a history of pipeline runs.Workflows
If a Workflow applies to a given entity, any actions you can perform are available under the Workflows link in the side panel of an entity.Repository
You can access more detailed information pulled from Bitbucket in the Repository link in the sidebar. At the top of the repository page, see the repositories associated with that entity. For cloud configurations, you can also see the most-used language in files for that entity. In the Top contributors block, you’ll find the three users who have contributed the most code and the number of their contributions. In the Commits section, you’ll find the 10 most recent commits and metadata about each. Below Commits is the Recent releases section, which includes the 5 most recent releases.Packages
Packages are automatically scraped from your Git repos or they can be submitted via the packages API. The package file must be in the root of your repository — or, if you’re usingbasepath, in the root of the subdirectory — to be scraped by Cortex. You can query an entity’s packages in CQL explorer using packages().
To view packages, click Packages in the entity’s sidebar.
The following package types are automatically scraped from repositories:
- JavaScript / Node.js:
package.json,package-lock.json,yarn.lock,pnpm-lock.yaml - Python:
requirements.txt,pipfile.lock - .NET (C#):
packages.lock.json - Java:
pom.xml - Go:
go.sum
Engineering homepage
Due to rate limits, Bitbucket ingestion on the homepage is limited to repositories mapped to a Cortex entity.
Eng Intelligence
- Due to rate limits, Bitbucket ingestion in Eng Intelligence is limited to repositories mapped to a Cortex entity.
- When using Bitbucket in Eng Intelligence, it’s highly recommended to use the workspace token configuration.
- Average PR open to close time
- Avg time to first review
- Avg time to approval
- PRs opened
- Weekly PRs merged
- Avg PRs reviewed/week
Scorecards and CQL
With the Bitbucket integration, you can create Scorecard rules and write CQL queries based on Bitbucket details. See more examples in the CQL Explorer in Cortex.Approvals required to merge
Approvals required to merge
The total number of approvals required to merge a Pull Request into the repository, defaulting to 0 if no approvals are defined.Definition:
git.numOfRequiredApprovals(): NumberExampleIn a Scorecard, you can write a rule to encourage at least one approval for each Pull Request:Git repository set
Git repository set
Check if an entity has a registered Git repository.Definition:
git (==/!=) null: BooleanExampleIn a Scorecard, you can write a rule that detects whether an entity has a Git repository set:Pipeline build success rate
Pipeline build success rate
The percentage of build pipelines that complete successfully. This is calculated against builds on the default branch, for commits in the last 30 days. The calculation is # successful builds / (# successful + # failed). Definition:
git.percentBuildSuccess(): NumberExampleIn a Scorecard, you can write a rule that requires at least 90% of build runs to be successful:View integration logs
This feature is available in Cortex cloud.

Background sync
Cortex conducts a background sync of Bitbucket identities every day at 10 a.m. UTC. Repositories are refreshed every day at 2 p.m. UTC.Troubleshooting and FAQ
Rules are failing saying that I don’t have filex, but I verified that the file exists.
We always use the default branch for file existence checks. Make sure that the file is present in the default branch.
Still need help?↗
The following options are available to get assistance from the Cortex Customer Engineering team:- Email: help@cortex.io, or open a support ticket in the in app Resource Center
- Slack: Users with a connected Slack channel will have a workflow added to their account. From here, you can either @CortexTechnicalSupport or add a
:ticket:reaction to a question in Slack, and the team will respond directly.