How can I get the repositoryId in the Bamboo CLI

When I try to clone a plan and I need change the subversion repository for different plan. But it also need specify the repositoryId when I try to "updateRepository". I would like to have automation way to get the repositoryId. Is it possible do it via this CLI?

Thank you.

Yongjun Rong

5 answers

Hi:

As workarround we execute a HTTP GET to:

http://<my_host>:8085/chain/admin/config/editChainRepository.action?os_username=<my_user>&os_password=<my_password>&planKey=<my_playkey>

using:

<my_host>: your bamboo host:

<my_user>: your bamboo user

<my_password>: your bamboo password

<my_plankey>: is the combination "PROJECT-PLAN" for your project ('-' must be included).

Then you can parse the response and search for repositoryId.

I only test this on bamboo 4.4.5, but maybe works on others versions.

Regards,

Good idea! Although I had to use buildKey instead of planKey for the releases I was testing with (4.2 and 5.0 EAP). Translating that into CLI terms, you can use:

--action renderRequest --quiet --request "/chain/admin/config/editChainRepository.action?buildKey=XXX-DEF" --findReplaceRegex ".*repositoryId=(\d+).*:\$1"

To get:
37159110

That only gets the first repository.

There isn't a way to list existing ones currently. Open an issue. If you run addRepository, then the repository id is returned on the command.

Thanks for your quick response. But need another getRepositoryId when specify and plan key and the repo name. No, I will try to access the db directly to get the id as a tempaory workaround.

I cannot use the addRepository because the repository is cloned when I try to clonePlan. I need updateRepository. Or when after clonePlan, it will be great if it can return the repositoryId

I will open an issue. Thank you again.

Sorry I cannot login to the onDemand

If you don't have an id already, click on: Create an account

Thanks Bob:

Just as a side note, on windows I had to remove the "\" scape character from \$ on:
.*repositoryId=(\d+).*:\$1

So the final sentence that works on windows will be:

--action renderRequest --quiet --request "/chain/admin/config/editChainRepository.action?buildKey=XXX-DEF" --findReplaceRegex ".*repositoryId=(\d+).*:$1"

Regards,

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Monday in Jira Ops

Jira Ops Early Access Program Update #1: Announcing our next feature and a new integration

Thanks for signing up for Jira Ops! I’m Matt Ryall, leader for the Jira Ops product team at Atlassian. Since this is a brand new product, we’ll be delivering improvements quickly and sharing updates...

460 views 0 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you