詹金斯传递Active Choices参数的值 [英] Jenkins pass value of Active Choices Parameter

查看:464
本文介绍了詹金斯传递Active Choices参数的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个詹金斯(Jenkins)工作,带有主动选择参数"(Active Choices Parameter)和主动选择反应参数".

I have a jenkins job with "Active Choices Parameter" and "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')]
            }
         }
      }
   }
}

我正在尝试调用jenkins作业并使用管道脚本传递参数值.但是,出现以下错误:

I am trying to call the jenkins job and pass parameter values using pipeline script. However, I am getting the following error:

参数"ActiveChoicesParam"的类型不符合 App_Build.转换为有效选择参数.

The parameter 'ActiveChoicesParam' did not have the type expected by App_Build. Converting to Active Choices Parameter.

参数"ActiveChoicesReactiveParam"的类型不符合 App_Build.转换为主动选择反应参数.

The parameter 'ActiveChoicesReactiveParam' did not have the type expected by App_Build. Converting to Active Choices Reactive Parameter.

它们(Dev和Server1)是有效值-如何传递这些值?

They (Dev and Server1) are valid values - How can I pass these values?

推荐答案

尝试设置为新的StringParameterValue的

Try setting up as new StringParameterValue's

build(job: "App_Build",
    parameters: [
        new StringParameterValue('ActiveChoicesParam', 'Dev'),
        new StringParameterValue('ActiveChoicesReactiveParam', 'Server1')
    ],
)

这篇关于詹金斯传递Active Choices参数的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆