脚本化的Jenkinsfile-运行中的多种选择

时间:2020-02-18 10:40:27

标签: jenkins jenkins-pipeline jenkins-groovy

我有一个脚本化管道,如下所示:

node(){
  stage("test"){
    echo "test"
  }
  stage("two"){
      deployOptions = "one\ntwo\nthree\nfour\nfive"

      def userInput = input(
        id: 'userInput', message: 'pick option', parameters: [
          [$class: 'ChoiceParameterDefinition', choices: deployOptions, description: 'Select deployment', name: 'deploy-pick']
      ])
    echo "you selected: ${userInput}"
  }
  stage("deploy"){
    echo "deploy"
  }
}

发生的事情是,第一阶段打印“测试”,第二阶段等待用户选择list([one,two,three,four,five]),在用户选择选项之后,管道运行“部署”阶段。

但是我现在想要的是,而不是从deployOptions列表中选择一个选项,而是希望能够选择多个选项(例如,预构建参数中的extendedChoice)。

1 个答案:

答案 0 :(得分:0)

没关系,我解决了。

我使用了"com.cwctravel.hudson.plugins.extended_choice_parameter.ExtendedChoiceParameterDefinition"类。

相关问题