How to add Bitbucket server repository from a Bitbucket project in Bamboo using Bamboo Command Line Interface (CLI)

This article explains how to add Bitbucket server repository from a specific Bitbucket project in Bamboo using Bamboo Command Line Interface (CLI).

Instructions

  • To add a global repository, combine addRepository with repositoryrepositoryKey, branch, targetServer, targetUser, targetPassword, target Bitbucket project with parameter field and value as repository.stash.projectKey= as shown below:

    --action addRepository --repository “Testing” --repositoryKey BITBUCKET_SERVER --branch master --targetServer "$Bitbucket_Server" --targetUser "$Bitbucket_User" --targetPassword "$Bitbucket_Password" --field repository.stash.projectKey=TEST
  • To add plan repository, combine addRepository with plan, repositoryrepositoryKey, branch, targetServer, targetUser, targetPassword, target Bitbucket project with parameter field and value as repository.stash.projectKey= as shown below:

    --action addRepository --plan "TES-TRAIN" --repository “Testing” --repositoryKey BITBUCKET_SERVER --branch master --targetServer "$Bitbucket_Server" --targetUser "$Bitbucket_User" --targetPassword "$Bitbucket_Password" --field repository.stash.projectKey=TEST
  • Additionally name parameter can be used to name the repository in Bamboo. 

It is recommended to test this scenario in a test environment or run the action with the --simulate parameter to verify the behavior before deploying.