Bamboo variable for second repository

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

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.

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



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.

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

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

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.

@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 ${}

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 :-) )

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

0 vote
Alex Wei Atlassian Team Apr 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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,499 views 0 5
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