Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bamboo variable for second repository

Dave Brunkow April 19, 2013

Is there a way to use a bamboo variable to reference the second source repository of a project. I can reference the default with ${bamboo.repository.svn.repositoryUrl} but how can I reference a second url without creating some custom/plan variable? There's no way to reference ${bamboo.repository.svn.repositoryUrl.repo2} ????

6 answers

1 accepted

0 votes
Answer accepted
Dave Brunkow April 21, 2013

They're trying to checkout from two different paths in the same repository. I believe the id you're referring to differentiates subversion instances which is not what we have here.

I may have to go with the hack, by putting the repository urls in global variables and reference them in the Source Repository setups and as a global variable also in the scripting piece. It works, jus thought there was a better way.

Jan Swaelens
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.
April 22, 2013

You will get different 'IDs' as soon as you define more than one source repo in the bamboo plan. Checking your plan configuration should tell you if this is the case.

Using the plugin you would be able to reference them both using these variables

myCustomLabelForTheFirst.repository.svn.repositoryUrl
myCustomLabelForTheSecond.repository.svn.repositoryUrl



1 vote
PiotrA
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.
April 21, 2013

Hello Dave,

I'm afraid that this particular variable you're after (bamboo.repository.svn.repositoryUrl) is not using the mechanism I was talking about. So as for your question my current answer is "no, you can't reference second SVN repository url".

Just for completeness - the mechanism I was talking about in the other answer injects a repository ID (not an ordering number like 1 - I was wrong on that) between the *second* and *third* chunk of the variable name. So with the example of ${bamboo.repository.svn.repositoryUrl} I'd expect that one can reference multiple repositories with a syntax like

${bamboo.repository.7435123.svn.repositoryUrl}
${bamboo.repository.5432125.svn.repositoryUrl}
${bamboo.repository.1231235.svn.repositoryUrl}

Where the numbers are ID's of plan repositories.

Is there anything else we can help you with?

regards

1 vote
Jan Swaelens
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.
April 19, 2013

Hello,

You could use this plugin to map these repo's to a name of your choice: https://marketplace.atlassian.com/plugins/be.sofico.bamboo-repopropertymate-plugin

(disclaimer: I wrote it :-) )

1 vote
Bryan Dyck April 19, 2013

You can find the magic number(s) for non-default repositories if you look at the Metadata page for a completed build; in the list of variables, you should see entries like this:

repository.$NUMBER.name
repository.$NUMBER.branch
etc.

for each non-default repository that's part of the build plan.

EddieW
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.
April 19, 2013

@Piotr is right, but I think to @bdyck's poitn, the numbers are the full ID of the repository (i.e. 78586993) and not the ordered number. You can see them listed on the metadata page, just copy the whole variable name string and wrap it in ${}

1 vote
PiotrA
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.
April 19, 2013

Hi Dave,

I recall there is undocumented way to reference non-default source repository in bamboo variables. Although at the moment I can't check how exactly it is done (I can do that on Monday). I vaguelly remember that you need to specify a number in a variable name, so I'd try something like this:

{bamboo.repository.1.svn.repositoryUrl}
{bamboo.1.repository.svn.repositoryUrl}
{bamboo.repository.svn.1.repositoryUrl}

...I remember that the number is injected somewhere between two dots in the variablle name.

Dave Brunkow April 19, 2013

Tried those three with leading $, plus ${bamboo.repository.svn.repositoryUrl.1} and they all give me bad substitution.

${bamboo.repository.svn.repositoryUrl.1}: bad substitution

PiotrA
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.
April 19, 2013

Well, in that case I'll check the variable syntax for you on Monday, ok? Please ping me here if I forget...

0 votes
Alex Wei (DE)
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 26, 2016

I found the solution at http://stackoverflow.com/questions/27371629/how-to-tag-a-git-repo-in-a-bamboo-build.

${bamboo.planRepository.repositoryUrl} points to the first repo in your "Source Code Checkout" task. The more specific URLs are referenced via:

${bamboo.planRepository.1.repositoryUrl}
${bamboo.planRepository.2.repositoryUrl}
...

and so on.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events