Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to parameterize Bamboo builds?

Please note, although my specific example here involves Java/Grails, it really applies to any type of task available in Bamboo.

I have a task that is a part of a Bamboo build where I run a Java/Grails app like so:

grails run-app -Dgrails.env=<ENV>

Where "<ENV>" can be one of several values (dev, prod, staging, etc.). It would be nice to "parameterize" the plan so that, sometimes, it runs like so:

grails run-app -Dgrails.env=dev

And other times, it runs like so:

grails run-app -Dgrails.env=staging

etc. Is this possible, if so, how? And does the REST API allow me to specify parameter info so I can kick off different-parameterized builds using cURL or wget?

like image 452
IAmYourFaja Avatar asked May 07 '14 01:05

IAmYourFaja


1 Answers

This seems to be a work around but I believe it can help resolve your issue. Atlassian has a free plugin call Bamboo Inject Variables Plugin. Basically, with this plugin, you can create an "Inject Bamboo Variables from file" task to read a variable from a file.

So the idea here is to have your script set the variable to a specific file then kick off the build; the build itself will read that variable from the file and use it in the grails task.

UPDATE

After a search, I found that you can use REST API to change plan variables (NOT global). This would make your task simpler: just define a plan variable (in Plan Configuration -> tab Variables) then change it every time you need to. The information on how to change is available at Bamboo Knowledge Base

like image 184
tmlai Avatar answered Oct 31 '22 21:10

tmlai