Skip to content
This documentation applies to Codacy Self-hosted v10.0.0

For the latest updates and improvements, see the latest Cloud documentation instead.

Bitbucket Server#

Follow the instructions below to set up the Codacy Self-hosted integration with Bitbucket Server.

To integrate Codacy with Bitbucket Server, you must create an application link on your Bitbucket Server instance:

  1. Create a key pair to sign and validate the requests between Codacy and the Bitbucket Server instance.

    Run the following command to create the key pair using the RSA algorithm in the PKCS#8 format:

    bash <(curl -fsSL https://raw.githubusercontent.com/codacy/chart/master/docs/configuration/integrations/generate-bitbucket-server-secrets.sh)
    

    Store the keys in a safe place for usage in the next steps and as a backup.

  2. Open <bitbucket server url>/plugins/servlet/applinks/listApplicationLinks, where <bitbucket server url> is the URL of your Bitbucket Server instance.

  3. Create a new application link with the URL of your Codacy instance.

    Important

    If you're using Bitbucket Server 7.20 or later you must select the application type Atlassian product while creating the new application link.

    This forces the integration to use OAuth 1.0 and is necessary to ensure the compatibility between Codacy and older versions of Bitbucket that only supported OAuth 1.0.

    Bitbucket Server application link

    If Bitbucket Server may warn you that there was no response from the URL you entered. This is expected, and you can click Continue after verifying that the URL is correct.

    No response from Codacy instance URL

  4. Fill in the fields:

    • Application Name: Name of the application. For example, Codacy.
    • Application Type: Select Generic Application.

    The remaining fields should be left blank.

    Bitbucket Server application link naming

  5. After creating the new application link, click Edit to add an incoming authentication.

  6. Fill in the fields of the incoming authentication:

    • Consumer Key: Enter the consumerKey generated previously.
    • Consumer Name: Name of the consumer. For example, Codacy.
    • Public Key: Enter the consumerPublicKey generated previously.

    The remaining fields should be left blank.

    Bitbucket Server incoming authentication

Configure Bitbucket Server on Codacy#

After creating the Bitbucket Server application link, you must configure it on Codacy:

  1. Edit the file values-production.yaml that you used to install Codacy.

  2. Set global.bitbucketEnterprise.enabled: "true" and define the remaining values as described below and with the information obtained when you created the Bitbucket Server application link:

    bitbucketEnterprise:
      enabled: "true"
      login: "true" # Show login button for Bitbucket Server
      hostname: "bitbucket.example.com" # Hostname of your Bitbucket Server instance
      protocol: "https" # Protocol of your Bitbucket Server instance
      port: 7990 # Port of your Bitbucket Server instance
      consumerKey: "" # Generated when creating the Bitbucket Server application link
      consumerPublicKey: "" # Generated when creating the Bitbucket Server application link
      consumerPrivateKey: "" # Generated when creating the Bitbucket Server application link
      contextPath: "" # Context path of your Bitbucket Server, if configured
    
  3. Apply the new configuration by performing a Helm upgrade. To do so execute the command used to install Codacy:

    Important

    If you're using MicroK8s you must use the file values-microk8s.yaml together with the file values-production.yaml.

    To do this, uncomment the last line before running the helm upgrade command below.

    helm upgrade (...options used to install Codacy...) \
                 --version 10.0.0 \
                 --values values-production.yaml \
                 # --values values-microk8s.yaml
    

After this is done you will be able to use Bitbucket Server to authenticate to Codacy.

Share your feedback 📢

Did this page help you?

Thanks for the feedback! Is there anything else you'd like to tell us about this page?

We're sorry to hear that. Please let us know what we can improve:

Alternatively, you can create a more detailed issue on our GitHub repository.

Thanks for helping improve the Codacy documentation.

If you have a question or need help please contact support@codacy.com.

Last modified July 15, 2022