# How to Connect Teamscale to BitBucket

Teamscale can connect to both the BitBucket Cloud version, as well as the BitBucket Server (On-Premise) version.

# Bitbucket Cloud Integration

Teamscale integrates with Bitbucket Cloud as a Bitbucket App. Prerequisites for the configuration are

  • a Teamscale license with Bitbucket support enabled
  • a Teamscale installation that can be reached from the Bitbucket Cloud instance you want to connect to, and
  • a Bitbucket team used to register the Bitbucket App. Please note that this app needs to be installed on the team account, so that Teamscale could have access to all available repositories of your team.

To connect to BitBucket cloud, the following steps are needed:

  1. Ensure that the public base URL is configured correctly in Teamscale. For this, open the settings page ( Admin / Settings ) and check the entry Teamscale instance base URL in tab Server Settings . This should point to the URL of the server that is reachable by the Bitbucket installation.

  2. In Bitbucket, navigate to the settings page of your team. Open Installed apps and click the link Install app from URL. Here you can provide the App URL to directly install the app.

    App URL: This is the public URL of your Teamscale installation followed by bitbucket-install, so for the sample Teamscale URL https://teamscale.acme.com this would be https://teamscale.acme.com/bitbucket-install.

  3. After clicking Install, the app will request access to Bitbucket. Click Grant access. You will get a message that the app has been successfully installed and will appear in the list of installed apps.

No Project Mirroring

Note that Teamscale projects are not automatically created, but rather have to be created as needed using the Bitbucket connector after the app has been installed.

When testing Teamscale on a local laptop or during initial setup, a service for exposing local ports on the internet can be helpful. One such service is ngrok.

# Bitbucket Server (On-Premise) Integration

Teamscale integrates with Bitbucket Server (On-Premise) using the available API and web hooks.

Minimum BitBucket Version

The minimum required Bitbucket server version for the integration to work is 5.10.0.

To connect a project to code from a Bitbucket project, no global configuration is required. You just need to follow these steps:

  1. Ensure that the public base URL is configured correctly in Teamscale. For this, open the settings page ( Admin / Settings ) and check the entry Teamscale instance base URL in tab Server Settings . This should point to the URL of the Teamscale server.

  2. Select the Bitbucket Server (On-Premise) connector during project creation.

  3. Select or create an account for the Bitbucket server. The account's fields should be filled out as follows:

    • URI: Bitbucket server's root URL (e.g., https://bitbucket.my-company.com ).

    • Username: The username of a user who has REPO_ADMIN rights on the Bitbucket server.

    • Password: The user's password or personal access token with Admin permissions for both the project and repository. To obtain a personal access token in Bitbucket, navigate to your user's Manage account page and select the Personal access tokens page.

  4. Complete project creation as usual, by providing the full name of the Bitbucket repository and completing any other required fields. The name should be in this format projectKey/repoSlug.

As the first step in project creation, Teamscale will register its web hook with the project. After this, Teamscale will automatically be informed about events in the project, such as pushes to the repository and changes to any merge requests.