小编典典

詹金斯传递Active Choices参数的值

jenkins

我有一个詹金斯工作,带有“主动选择参数”和“主动选择反应参数”。

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')]
            }
         }
      }
   }
}

我试图调用詹金斯的工作,并使用管道脚本传递参数值。但是,我收到以下错误:

参数’ActiveChoicesParam’不具有App_Build期望的类型。转换为有效选择参数。

参数’ActiveChoicesReactiveParam’不具有App_Build期望的类型。转换为活动选择反应参数。

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


阅读 331

收藏
2020-07-25

共1个答案

小编典典

尝试将其设置为新的StringParameterValue

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