Creating the Bitbucket App

To enable Bitbucket integration in your app, you need to create a Bitbucket OAuth Consumer app using your BitBucket account. This Bitbucket app can then be authenticated to access repositories of users’ account.

Follow these steps to create the Bitbucket OAuth Consumer app and integrate it with truefoundry:

  • Sign in to bitbucker.org. Navigate to Workspace Settings(preferably for your organization).

  • Navigate to OAuth Consumers under Apps and features.

  • Click the button to Add consumer

  • Fill in the following details:

    • Name: This can be anything. Consider something like <Organization>‘s Bitbucket or <Your Name>‘s Bitbucket or something else descriptive.

    • Redirect URI: https://app.example-org.truefoundry.com/api/svc/v1/vcs/bitbucket/callback (replace app.example-org.truefoundry.com with your control plane URL)

    • Select the following permissions:

      • Account: Email, Read
      • Projects: Read
      • Repositories: Read, Write(to allow adding CI/CD PR)
      • Pull requests: Read, Write(to allow adding CI/CD PR)
  • Apply. Copy the Key and Secret from created app.

  • Set environment variables in servicefoundryServer :
    BITBUCKET_CLIENT_ID=${Key} BITBUCKET_CLIENT_SECRET=${Secret}

  • If using CI/CD for control plane deployment follow below:

    • Add these keys and values in the truefoundry-creds k8s secret present in truefoundry namespace.
      BITBUCKET_CLIENT_ID=${Key} BITBUCKET_CLIENT_SECRET=${Secret}
    • In the truefoundry application values file, use the value as ${k8s-secret/truefoundry-creds/BITBUCKET_CLIENT_ID} and ${k8s-secret/truefoundry-creds/BITBUCKET_CLIENT_SECRET}

Bitbucket is linked via OAuth. This will allow use of any repository you have access to. We can easily link our Bitbucket account in few steps as mentioned below:

  • Click on the Link Bitbucket button present in the top right corner of the Bitbucket tab for linking your Bitbucket account as shown below:
  • Your bitbucket account which is signed in to your system will get linked. You will now be able to see your account on the dashboard as shown below:
  • You can also see the connected repositories of your account by clicking on ⚙️ button on the right side of that particular account.
  • Note : In this connected repositories section you will only see the repositories that you have admin access. Only these repositories can be used to make deployment on the platform.
  • You can also unlink your account by unlink button. It can be seen in the above figure.