Bitbucket Data Center (Server)

Integrating your Bitbucket Data Center (formerly Bitbucket Server) instance with DeepSource requires creating a custom incoming Application link to facilitate OAuth 2.0. This document outlines the configuration, permission requirements, and app configuration to get started with your Bitbucket Data Center instance and DeepSource Enterprise.

Creating an application link on Bitbucket Data Center

🚧

Things to note before you proceed

  • You will require SYSTEM_ADMIN permission on the Bitbucket Data Center instance to be able to create an Application Link.
  1. Register a new Application Link in your Bitbucket Data Center instance. For example, if your instance is running on https://bitbucket.stark.com, then this settings page will be located at https://bitbucket.stark.com/plugins/servlet/applinks/listApplicationLinks.

  2. You'd be prompted to fill out a form to create a new application. Enter the following details:

    📘

    Replace ORGANIZATION_NAME with the name of your organization, and HOSTNAME with the actual hostname on which DeepSource Enterprise instance is deployed.

    FieldValueExample
    NameDeepSource ORGANIZATION_NAMEDeepSource Stark International
    Redirect URLhttps://HOSTNAME/accounts/bitbucket_datacenter_oauth2/login/callback/bifrosthttps://deepsource.stark.com/accounts/bitbucket_datacenter_oauth2/login/callback/bifrost/
    Application permissionsCheck the ADMIN box under PROJECTS

Why do we require PROJECT_ADMIN permission?

DeepSource Enterprise uses the OAuth2 token obtained from this application to perform all API and git operations on your Bitbucket Data Center instance. Admin permissions are required at the project level to register webhooks to listen for project and repository level events.

  1. Click on "Save changes".
  2. On the next page, You will get theClient ID and Client Secret. Enter these values in the DeepSource Enterprise admin console.

Configuration in the DeepSource Admin Console

After you have created your Bitbucket Data Center application, you need to configure it in the DeepSource Admin Console.

  1. Visit the Admin Console
  2. Navigate to Application -> Config.
  3. Select the checkbox for Bitbucket Data Center.
  1. Fill in the values for the following fields as explained in each field's subtext:
    1. Bitbucket Data Center Host HTTP Scheme
    2. Bitbucket Data Center Host Domain
    3. Bitbucket Data Center OAuth2 Key
    4. Bitbucket Data Center OAuth2 Secret
    5. Bitbucket Data Center Webhook Secret
  1. Click "Save config".
  2. Deploy the new release with the updated config using the "Version history" tab.