Jenkins pass value of Active Choices Parameter

99封情书 提交于 2020-04-17 22:51:58

问题


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

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

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

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

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


回答1:


Try setting up as new StringParameterValue's

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


来源:https://stackoverflow.com/questions/60305791/jenkins-pass-value-of-active-choices-parameter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!