如何参数化Bamboo版本? [英] How to parameterize Bamboo builds?
问题描述
请注意,尽管我在此处的特定示例涉及Java/Grails,但实际上它适用于Bamboo中可用的任何类型的任务.
Please note, although my specific example here involves Java/Grails, it really applies to any type of task available in Bamboo.
我有一个任务是Bamboo版本的一部分,在这里我像这样运行Java/Grails应用程序:
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>
其中"<ENV>
"可以是多个值(dev
,prod
,staging
等)之一.最好参数化"计划,这样有时会像这样运行:
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
等如果可能的话,这可能吗? REST API是否允许我指定参数信息,以便可以使用cURL
或wget
启动不同参数的构建?
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
?
推荐答案
这似乎可以解决,但我相信它可以帮助解决您的问题. Atlassian有免费的插件调用 Bamboo注入变量插件.基本上,使用此插件,您可以创建从文件插入Bamboo变量"任务以从文件读取变量.
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.
所以这里的想法是让您的脚本将变量设置为特定文件,然后开始构建.构建本身会从文件中读取该变量,并在grails任务中使用它.
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.
更新
搜索后,我发现您可以使用REST API更改计划变量(不是全局变量).这会使您的任务更加简单:只需定义一个计划变量(在计划配置"->变量"选项卡中),然后在每次需要时进行更改.有关如何更改的信息,请访问竹子知识库
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
这篇关于如何参数化Bamboo版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!