[英]Jenkins pass value of Active Choices Parameter
I have a jenkins job with "Active Choices Parameter" and "Active Choices Reactive Parameter".我有一份 jenkins 工作,其中包含“Active Choices Parameter”和“Active Choices Reactive Parameter”。
pipeline {
agent { label 'Agent_Name' }
stages {
stage('Build') {
steps {
script {
def res=build job: 'App_Build', parameters: [string(name: 'ActiveChoicesParam', value: 'Dev'),string(name: 'ActiveChoicesReactiveParam', value: 'Server1')]
}
}
}
}
}
I am trying to call the jenkins job and pass parameter values using pipeline script.我正在尝试调用 jenkins 作业并使用管道脚本传递参数值。 However, I am getting the following error:
但是,我收到以下错误:
The parameter 'ActiveChoicesParam' did not have the type expected by App_Build.
参数“ActiveChoicesParam”没有 App_Build 预期的类型。 Converting to Active Choices Parameter.
转换为 Active Choices 参数。
The parameter 'ActiveChoicesReactiveParam' did not have the type expected by App_Build.
参数“ActiveChoicesReactiveParam”没有 App_Build 预期的类型。 Converting to Active Choices Reactive Parameter.
转换为主动选择反应参数。
They (Dev and Server1) are valid values - How can I pass these values?它们(Dev 和 Server1)是有效值 - 如何传递这些值?
Try setting up as new StringParameterValue's尝试设置为新的 StringParameterValue
build(job: "App_Build",
parameters: [
new StringParameterValue('ActiveChoicesParam', 'Dev'),
new StringParameterValue('ActiveChoicesReactiveParam', 'Server1')
],
)
somehow new StringParameterValue( 'key', 'value' )
doesn't work for me.不知何故
new StringParameterValue( 'key', 'value' )
对我不起作用。 I'm using;我正在使用;
List<ParameterValue> newParams = [
[$class: 'StringParameterValue' , name: 'ActiveChoicesParam' , value: 'Dev' ] ,
[$class: 'StringParameterValue' , name: 'ActiveChoicesReactiveParam', value: 'Server1'] ,
]
def res = build ( job: 'App_Build' ,
propagate : false ,
wait : true ,
parameters: newParams
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.