我在dsl作业中使用Active Choices反应参考参数插件,此处代码
parameters {
activeChoiceParam('choice1') {
description('select your choice')
choiceType('RADIO')
groovyScript {
script("return['aaa','bbb']")
fallbackScript('return ["error"]')
}
}
activeChoiceReactiveParam('choice2') {
description('select your choice')
choiceType('RADIO')
groovyScript {
script("if(choice1.equals("aaa")){return ['a', 'b']} else {return ['aaaaaa','fffffff']}")
fallbackScript('return ["error"]')
}
referencedParameter('choice1')
}
Run Code Online (Sandbox Code Playgroud)
我现在想要的是如何在jenkinsFile中使用activeChoiceReactiveParam进行管道作业,这很好,我做到了:
properties(
[
[
$class : 'ParametersDefinitionProperty',
parameterDefinitions: [
[
$class : 'ChoiceParameterDefinition',
choices : 'aaa\nbbb',
description: 'select your choice : ',
name : 'choice1'
]
Run Code Online (Sandbox Code Playgroud)
但是我怎么能添加choice2参数!
我正在尝试使用jenkins DSL脚本将作业放入文件夹中现在,我创建一个listView并将我使用的代码放入作业中
listView('MyJobsList') {
jobs {
map.each{
name((it.key).trim())
}
}
columns{
status()
weather()
name()
lastSuccess()
lastFailure()
lastDuration()
buildButton()
}
}
Run Code Online (Sandbox Code Playgroud)
我想做同样的事情,但是这次我想把工作放在一个文件夹中!
在 jenkinsfile 中,我想获取工作区目录中的文件列表并将它们放入参数中。我试过:
stage('select'){
def workspace = pwd()
files = []
new File ("$workspace/buildFile").eachFile(FileType.FILES) { files << it.name }
BuildFile = input( id: 'userInput', message: 'Sélectionner un backup', parameters: [ [$class: 'ChoiceParameterDefinition', choices: files , description: 'Properties', name: 'param'] ])
}
Run Code Online (Sandbox Code Playgroud)
但我收到消息错误“java.io.FileNotFoundException:”