How to establish link between Bitbucket and Bamboo with Atlassian Command Line Interface (CLI)

This article explains how to add Bamboo application links to Bitbucket and the reciprocal link of Bitbucket in Bamboo using Command Line Interface (CLI). Use Atlassian Command Line Interface v8.6 or above to connect the two applications.

Instructions

Use addApplicationLink action to add the application links and establish a successful connection. By default, both incoming and outgoing links are enabled.

  1. Make sure the acli.properties file in the CLI client folder contains server details of both Bitbucket and Bamboo applications. Refer to the CLI Client Installation and Use for the installation guide.
  2. Remove the default application in the acli.properties file as the actions are performed in Bitbucket and Bamboo simultaneously. Here is a sample properties file for your reference: 

  3. Run the following commands to add links in the respective applications:

    bambooLocal --action addApplicationLink --url http://localhost:7990 
    bitbucketLocal --action addApplicationLink --url http://localhost:8085

    In this example, bambooLocal and bitbucketLocal are names assumed for the Bamboo and Bitbucket instances. These values must be replaced with the names of your instances.

The links are established as shown:

  • From Bamboo to Bitbucket:
  • From Bitbucket to Bamboo:

If required, you can disable the incoming and outgoing links. Use the --options disableIncoming and --options disableOutgoing parameters along with the action command. A sample action command for the same is as follows:

bambooLocal --action addApplicationLink --url http://localhost:7990 --options disableIncoming --options disableOutgoing
bitbucketLocal --action addApplicationLink --url http://localhost:8085 --options disableIncoming --options disableOutgoing

The application link URL uses the base URL configured in your application to connect to the respective application.

  • Make sure the server base URL is the same as the application URL.
  • Use '--options impersonate' with the addApplicationLink action to enable shared users.
  • It is recommended to test this scenario in a non-production environment, or run the action with the --simulate parameter to verify the behavior before deploying.