Using capabilities to resolve the path to an executeable

Consider this scenario:

  • we have 1 set of scripts to build two projects
  • the first project requires a certain executable (lets say GWT 2.0)
  • the second project requires another executeable (lets say GWT 2.4)

I configured two custom capabilities on the bamboo server: GWT2.0 and GWT 2.4.

Each project has its own plan in bamboo and the relevant jobs are marked with the relevant requirement.

To pass the location of the GWT folder to each build script (Ant) I pass a system property to the build target like this:

-DgwtHome=${bamboo.capability.GWT_XYZ}

What troubles me is that I need to alter this system property to include the correct capability's path. What I would want to do is:

  1. Add the capability to the job for the relevant GWT version (already doing that)
  2. Referencing the capability in a generic way to be able to do something like:
-DgwtHome=${bamboo.capability.GWT}

This would require something like a custom type level on capabilities along with the possibility to find a capability based on its type using bamboo variabled.

Is something like this possible? Are there other ways of doing this kind of abstraction?
I have several cases where I could use this patterns, its not only for the GWT compiler location (app server location for ejb compiles ...).

many thanks

3 answers

1 accepted

I dont think there is a native way to do what you are wanting... the capability part of the variable I believe is only designed to obtain the value of that particular agent's capability so it can be used. So if AgentA had GWT 2.0 in "/usr/bin" and AgentB had GWT 2.0 in "/usr/local/bin" then you could get the path for that particular build.

Yeah that's what I thought, maybe Atlassian would find this something neath to add to the product?

Thanks for your input!

According to the Bamboo documentation one is supposed to do this, but it does not appear to work. See the documentation -- https://confluence.atlassian.com/display/BAMBOO/Bamboo+variables#Bamboovariables-Usingcapabilities

And I found references to this capability back in Bamboo 2.

Following the instructions to see the value to be used I use this in a script task (Bamboo running on Linux)

echo "GIT ${bamboo.capablity.system.git.executable}"

I get errors like this

02-Jan-2014 11:01:02	/prodinfolocal/atlassian-bamboo-5.2/temp/E2P-GD-CR-12-ScriptBuildTask-6848542872684244705.sh: line 2: GIT at ${bamboo.capablity.system.git.executable}: bad substitution

This actually works if you

Just to help anyone looking, this does in fact work.  There is a typo in the syntax listed in the response:

${bamboo.capability.system.git.executable}

Also, you would need to pass this as an argument into the script for it to work correctly. 

Suggest an answer

Log in or Join to answer
Community showcase
Renan Battaglin
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,066 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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot