我试图为一个活动参数添加多个React参数。但是当我在Jenkins Pipeline中实现它时,第二个React参数正在回退脚本。但是当我试图通过Jenkins Console做同样的事情时,它正在工作。那么,为什么它不通过管道工作?任何帮助都将不胜感激。
管道脚本
pipeline {
parameters{
activeChoice choiceType: 'PT_SINGLE_SELECT',
filterLength: 1,
filterable: false,
name: 'Env',
randomName: 'choice-parameter-25251019944217',
script:
groovyScript(
fallbackScript: [
classpath: [],
oldScript: '',
sandbox: true,
script: 'return[\'Could not get Env\']'],
script: [classpath: [],
oldScript: '',
sandbox: true,
//script: 'return'+func1()
script: 'return[\'demo\',\'tenant\']'
]
)
reactiveChoice choiceType: 'PT_SINGLE_SELECT',
filterLength: 1,
filterable: false,
name: 'machines',
randomName: 'choice-parameter-37944444770435',
referencedParameters: 'Env',
script:
groovyScript(
fallbackScript: [
classpath: [],
oldScript: '',
sandbox: true,
script: 'return[\'error\']'],
script: [classpath: [],
oldScript: '',
sandbox: true,
script: '''if(Env.equals('tenant')){
return[\'tenant1\',\'tenant2\']
}
else if(Env.equals(\'demo\')){
return[\'demo1\',\'demo2\']
}'''
]
)
reactiveChoice choiceType: 'PT_SINGLE_SELECT',
filterLength: 1,
filterable: false,
name: 'servers',
randomName: 'choice-parameter-37944444770435',
referencedParameters: 'Env',
script:
groovyScript(
fallbackScript: [
classpath: [],
oldScript: '',
sandbox: true,
script: 'return[\'error\']'],
script: [classpath: [],
oldScript: '',
sandbox: true,
script: '''if(Env.equals('tenant')){
return[\'dotnet\',\'php\']
}
else if(Env.equals(\'demo\')){
return[\'nodejs\',\'php\']
}'''
]
)
}
agent any
stages {
stage ("Example") {
steps {
script{
echo 'Hello'
echo "${params.Env}"
} }
}
}
字符串
Jenkins控制台问题
的数据
1条答案
按热度按时间bweufnob1#
我把我的参数移到属性部分。现在它可以工作了。
字符串