我有以下代码构建为job-dsl,使用" Active Choice Plugin":
freeStyleJob('job') {
description('description')
// Label which specifies on which nodes this job can be run.
label('master')
logRotator {
numToKeep(10)
}
//This Build is parametrized
parameters {
activeChoiceReactiveParam('branch') {
description('Select the branch you are going to use')
choiceType('SINGLE_SELECT')
script('["integration", "master"]')
fallbackScript('"Error. No branch to select."')
filterable(true)
}
}
}
我在执行时遇到以下错误:
如何解决这个错误?
答案 0 :(得分:1)
语法实际上有点不同:
job('example-1') {
parameters {
activeChoiceReactiveParam('CHOICE-1') {
description('Allows user choose from multiple choices')
filterable()
choiceType('SINGLE_SELECT')
groovyScript {
script('["choice1", "choice2"]')
fallbackScript('"fallback choice"')
}
referencedParameter('BOOLEAN-PARAM-1')
referencedParameter('BOOLEAN-PARAM-2')
}
}
}
使用API查看器查找语法: https://jenkinsci.github.io/job-dsl-plugin/#path/job-parameters-activeChoiceReactiveParam