JobDSL - 没有方法签名 java.lang.String
JobDSL - No signature of method java.lang.String
我有以下代码可以构建为 "Active Choice Plugin" 的 job-dsl:
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)
}
}
}
我在执行它时出现以下错误:
如何解决这个错误?
语法实际上有点不同:
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
我有以下代码可以构建为 "Active Choice Plugin" 的 job-dsl:
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)
}
}
}
我在执行它时出现以下错误:
如何解决这个错误?
语法实际上有点不同:
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