How to parameterize Bamboo builds?

喜欢而已 提交于 2019-12-22 06:59:15

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/23507157/how-to-parameterize-bamboo-builds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!