【发布时间】:2019-07-23 06:12:53
【问题描述】:
使用 Jenkins 2
想从 git 存储库生成动态选择。因此,在 groovySrcipt 的脚本部分中,
job('example') {
parameters {
activeChoiceParam('CHOICE-1') {
description('Allows user choose from multiple choices')
filterable()
choiceType('SINGLE_SELECT')
groovyScript {
// script('["choice1", "choice2"]')
script('-DYNANIC CHOICES-REF-PESUDO-CODE')
fallbackScript('"fallback choice"')
}
}
}}
伪代码
groovyScript {
script('
// call git repo and fetch some branches info.
// collect them in some local variable and return them as choices
def branches = "git branch -l"
return branches
')
fallbackScript('"fallback choice"')
}
在我的情况下,它总是要回退脚本。 请分享您的意见。
【问题讨论】: