How can I get the repositoryId in the Bamboo CLI

Yongjun Rong May 21, 2013

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

1 vote
Alvaro Castro June 27, 2013

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,

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 28, 2013

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.

0 votes
Alvaro Castro July 1, 2013

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,

0 votes
Yongjun Rong May 21, 2013

Sorry I cannot login to the onDemand

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2013

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

0 votes
Yongjun Rong May 21, 2013

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.

Yongjun Rong May 21, 2013

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.

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2013

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events