Skip to main content

How to set up Bitbucket

Updated this week

Setup takes about 5 minutes.

Introduction

Use the Bitbucket connector when you want Foundational to access source code in Bitbucket. The setup uses an API access token and supports standard Bitbucket Cloud deployments.

To make the connection, you need to:

  • Create or assign an API access token

  • Grant the required access permissions

  • Create user credentials

  • Connect Foundational to Bitbucket


Prerequisites

Ensure you have:

  • Access to Bitbucket

  • Permissions to create an API access token

  • Group or project Maintainer access to create the required webhooks


Access permissions

Access to Bitbucket allows Foundational to determine data lineage and analyze pending and historical pull requests. Permissions are granted through a Bitbucket API access token.

Foundational requires access so it can:

  • Read repository source code

  • Read pull requests

  • Receive webhook events

  • Comment on pull requests


Create or assign user credentials

Bitbucket authentication uses an API access token.

Select one option.

Option 1: Workspace access token (preferred)

Use a workspace access token to cover all repositories in a workspace.

  1. In Bitbucket, create a workspace access token. See the Bitbucket article Create an access token for a workspace.

  2. Assign the following permissions:

    • Repositories: Read

    • Pull Requests: Read

    • Webhooks: Read & Write

    • Pipelines: Read & Write

  3. Give the token a descriptive name (e.g., foundational-app). This name appears as the author of Foundational pull request comments.

  4. Set the longest expiry allowed by your policy to reduce service disruptions.

Option 2: Repository access token

Use this option if you cannot use a workspace access token. See the Bitbucket article Access tokens for a repository.

  1. Create a repository access token for each repository you want to cover.

  2. Assign the following permissions:

    • Repositories: Read

    • Pull Requests: Read

    • Webhooks: Read & Write

    • Pipelines: Read & Write


Connect Foundational to Bitbucket

  1. In Foundational, open the Connectors & Integrations page.

  2. In Source Control, select the Bitbucket card and click Connect.

  3. Click Add Access Key.

  4. The initial setup screen opens. Click Start Setup.

  5. The Set Up New Connection screen opens.

    Enter the details:

    • API Access Token: The workspace or repository access token you created earlier.

    • Workspace ID: The first part of the Bitbucket URL after bitbucket.org. Example:. For https://bitbucket.org/foundational-io, the Workspace ID is foundational-io.

  6. Click Next.

  7. The final setup screen opens. To complete the connection, click Save.

That’s it. Foundational is now connected to Bitbucket.

Did this answer your question?