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

Using capabilities to resolve the path to an executeable

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.
March 15, 2012

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

0 votes
Answer accepted
Cameron Ferguson
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.
March 26, 2012

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.

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, 2012

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

Thanks for your input!

Erik Husby January 1, 2014

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

1 vote
Ryan Petrick November 7, 2014

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. 

0 votes
Kevin Dixon October 7, 2013

This actually works if you

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events