Using build variable in subversion URL

In my development environment, there are about 10 projects, for each project, there are at least two builds (regular, and slower daily builds). Because of this, I would like to keep the bamboo configuration as generic as possible. According to the documentation, the following subversion URL ought to be valid. However, it looks like the substitution does not happen.

svn+ssh://svnrepos/myrepos/trunk/${bamboo.buildPlanName}

The logs show an SVNException:

atlassian-bamboo.log:Caused by: org.tmatesoft.svn.core.SVNException: svn: URL 'svn+ssh://svnrepos/myrepos/trunk/$%7Bbamboo.buildPlanName%7D' non-existent in revision '49,210'

3 answers

1 accepted

This widget could not be displayed.

You can't use "bamboo.buildPlanName" variable in the source repository URL substitution (as well as you can't use "buildNumber", "buildKey", "buildResultKey" nor "buildResultUrl") - these all are empty during code change detection. Where is the documentation that says the above subversion URL (svn+ssh://svnrepos/myrepos/trunk/${bamboo.buildPlanName}) ought to be valid? I'd like to look at the documentation and compare it with my findings...

Oh, I see the errors of my ways. In my enthusiasm, I missed that the 'avalable variables' column clearly does not build-specific variables!

Still, I wish it were possible as 99% of our builds have identical configurations with only the svn url differing. This can't be that unusual of a situation.

http://confluence.atlassian.com/display/BAMBOO/Using+Global%2C+Plan+or+Build-specific+Variables

Variables can be used in the following fields of your build plan:

<th class="confluenceTh" style="font-size: 10pt; line-height: 13pt; color: #000000; background-color: #f0f0f0; text-align: left; vertical-align: top; min-width: 0.6em; border-color: #dddddd; border-style: solid; padding: 5px;">Field</th><th class="confluenceTh" style="font-size: 10pt; line-height: 13pt; color: #000000; background-color: #f0f0f0; text-align: left; vertical-align: top; min-width: 0.6em; border-color: #dddddd; border-style: solid; padding: 5px;">Available variables</th>

...

Repository URL (for Subversion repositories only)
— see Specifying the Source Repository for a Plan
Global variables
System variables

How about using Plan Variables?

I'm not sure I follow, or (likely) I have not configured my projects/plans well and can't take advantage of this. Here is Project->Plan configuration I'm presently using: (the structure has changed since my initial message... lots of playing around...sorry for the moving target...)

Project1->trunk->DefaultJob (svn: http://svn/trunk/Project1)

ant clean all test -Dquick=true

Project1->daily->DefaultJob (svn: http://svn/trunk/Project1)

ant clean all test

Project2->trunk->DefaultJob (svn: http://svn/trunk/Project2)

ant clean all test -Dquick=true

Project2->daily->DefaultJob (svn: http://svn/trunk/Project2)

ant clean all test

...You can see where I'm going. My projects all have a common layout, and build targets. If I need to add more projects, which I do, or if I need to change my ant target in the future, and I'm sure I will. What is the best way to do that? Is there a true path to Bamboo nirvana???
Thanks!
This widget could not be displayed.

The only kind of variable that will be available to you during change detection is a 'capability' variable (like JDK=c:\Program Files\Java).

All other variables require a build context when they are applied and a build context is not available during change detection.

So no, there's no path to "Bamboo nirvana" as you put it, sorry.

The idea you had sounds good though - binding project names/plan names/job names to repository paths does sound like an efficient way of reducing redundancy in plan definitions between developers/projects/branches. I think it's best if you submit an improvement request.

Thanks Przemek,

You've been a great help. One thing that I did which should help me out in the future is I put my build targets in global variables standardBuildTargets and dailyBuildTargets, etc...

I will submit a feature request.

This widget could not be displayed.

What about plans with no automatic triggers?

Why in that cases is not posible to change dinamically the property "SVN Repository URL".

I think this situation is perfectly posible. And I think is very useful.

I would like trigger a plan manually with the option "Run customised" (changing the plan variables and finally the repository url be altered)

 

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

162 views 1 3
Join discussion

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