How to update the source repository branch in a manually created plan branch using bamboo cli
Asked by Girish:

Hi,

I am trying to update the source repository branch in a manually created plan branch using bamboo CLI.

1) I am an admin in the Bamboo Master.

2) I create a plan and added some stages and jobs in it. createPlan

3) I added an existing repository to the plan. addRepository

4) I created a plan branch with its name and description using addBranch

5)) I try to update the plan branch with the chainBranchRepository item being set to a specific branch but none of the arguments are getting updated. updateBranchingOptions

--action createPlan --plan "PROJECT-plan_11" --replace --projectName "PROJECT"  
--action addStage --plan @plan@ --stage "SETUP"  
--action addJob --plan @plan@ --stage [@stage](/t5/user/viewprofilepage/user-id/2862001)@ --job "SETUP"  
--action addRequirement --plan @plan@ --job [@Job](/t5/user/viewprofilepage/user-id/602232)@ --requirement "SIMULATION"  
--action addTask --plan @plan@ --job [@Job](/t5/user/viewprofilepage/user-id/602232)@ --taskKey "CHECKOUT" --description "setup" --field1 "repository" --value1 ""  
--action addRepository --plan @plan@ --name "myrepo" --branch "bugfix/SM-63220-fixing-bamboo-updateBranch-run"  
--action addBranch --plan @plan@ --branch "SM-63220" --enable  
--action updateBranchingOptions --plan "PROJECT-PLAN11" --field "planBranchCreationmatching_vcs_branch=true" --field "planBranchCreationRegularExpression=bugfix/SM-63220-fixing-bamboo-updateBranch-run"

I have tried multiple ways to update the source repository branch for a branch in a bamboo plan but with no results. I have looked up all the examples for bamboo CLI but there is nothing which helps me to updated the source repository branch for a plan branch.

Kindly provide your help to understand how one can update the source repository-branch for a plan branch.

![bamboo_source_repo_branch.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/96624iEFB9D8AA9BFC4F9F/image-size/large?v=v2&px=999 "bamboo_source_repo_branch.JPG")


Answers:
author: Reshma Begum {Appfire}
body: Hi [@Girish](/t5/user/viewprofilepage/user-id/3754086) ,

Thanks for submitting your question!

We have created [SUPPORT-4086](https://bobswift.atlassian.net/browse/SUPPORT-4086) to track the issue. Please access the Support request [SUPPORT-4086](https://bobswift.atlassian.net/browse/SUPPORT-4086)and once you signup, please let us know your username so that we can add yourself as the reporter to the support request.

Please let us know the version of Bamboo and the version of Command Line Interface (CLI) which you are using to troubleshoot the issue further.

Thanks,

Reshma

comments: author: Girish
body: Hi [@Reshma Begum {Appfire}](/t5/user/viewprofilepage/user-id/2278129)

Please find the Bamboo details below

Bamboo version : Version5.15.3

Bob Swift Atlassian Apps - Bamboo Command Line Interface (CLI) version : 9.2.0

Thanks,

Girish


author: Manisha Kharga _Appfire_
body: Hi [@Girish](/t5/user/viewprofilepage/user-id/3754086)

Hope you are doing great!

We have updated the support request [SUPPORT-4086](https://bobswift.atlassian.net/servicedesk/customer/portal/1/SUPPORT-4086) with the analysis, can you please refer to the details and let us know if you have any further queries.

Looking forward to your response.

Thanks,  
Manisha


author: Manisha Kharga _Appfire_
body: Hi [@Girish](/t5/user/viewprofilepage/user-id/3754086)

We would like to inform you that the Bamboo Command Line Interface (CLI) version 9.2.0 is not supported for the Bamboo version 5.15. We recommend you update the Bamboo version to the latest which is compatible with CLI version 9.2.

Use *getBranchingOptions* to view the available fields that can be set and then set the field value. After that execute the action *updateBranchingOptions* for the respective plan.

Before executing the update branch you can add the repository in your Build Plan than the Repository will be added after creating the branch.

Thanks,  
Manisha


author: Girish
body: Hi Manisha,

I was able to find the solution after I posted the question.

Solution: Is to use the addRepository command with proper branch name. The brnach name should not be containing any spaces or special characters in its name.

```
--action addRepository --plan @plan@ --name "myrepo" --branch "release/mybranch_name"
```

Thanks,

Girish


Tags: cli