6

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?

IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
  • 1
    What and how will you change that variable? – tmlai May 08 '14 at 15:53
  • Thanks @tmlai (+1) - the idea is that an automated process would kick off the build via Bamboo's [REST API](https://developer.atlassian.com/display/BAMBOODEV/REST+APIs), passing in the value of the `` param as a part of that RESTful call. – IAmYourFaja May 09 '14 at 12:21

1 Answers1

8

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

tmlai
  • 372
  • 1
  • 8