IT科技

使用Active Choice Parameter参数化构建

时间:2010-12-5 17:23:32  作者:IT科技类资讯   来源:IT科技类资讯  查看:  评论:0
内容摘要:复制properties([ parameters([ [$class:ChoiceParameter, choiceType:PT_

使用Active Choice Parameter参数化构建
复制properties([      parameters([          [$class: ChoiceParameter,使用数化               choiceType: PT_SINGLE_SELECT,               description: Select the Env Name from the Dropdown List,               filterLength: 1,               filterable: true,               name: Env,               randomName: choice-parameter-5631314439613978,               script: [                  $class: GroovyScript,                   fallbackScript: [                      classpath: [],                       sandbox: false,                       script:                           return[\Could not get Env\]                 ],                   script: [                      classpath: [],                       sandbox: false,                       script:                           return["Dev","QA","Stage","Prod"]                 ]              ]          ],           [$class: CascadeChoiceParameter,               choiceType: PT_SINGLE_SELECT,               description: Select the Server from the Dropdown List,               filterLength: 1,               filterable: true,               name: Server,               randomName: choice-parameter-5631314456178619,               referencedParameters: Env,               script: [                  $class: GroovyScript,                   fallbackScript: [                      classpath: [],                       sandbox: false,                       script:                           return[\Could not get Environment from Env Param\]                 ],                   script: [                      classpath: [],                       sandbox: false,                       script:                            if (Env.equals("Dev")){                                  return["devaaa001","devaaa002","devbbb001","devbbb002","devccc001","devccc002"]                              }                              else if(Env.equals("QA")){                                  return["qaaaa001","qabbb002","qaccc003"]                              }                              else if(Env.equals("Stage")){                                  return["staaa001","stbbb002","stccc003"]                              }                              else if(Env.equals("Prod")){                                  return["praaa001","prbbb002","prccc003"]                              }                  ]              ]          ]      ])  ])  pipeline {    environment {           vari = ""   }    agent any   stages {        stage ("Example") {          steps {           script{            echo Hello           echo "${params.Env}"           echo "${params.Server}"           if (params.Server.equals("Could not get Environment from Env Param")) {                echo "Must be the first build after Pipeline deployment.  Aborting the build"               currentBuild.result = ABORTED               return           }            echo "Crossed param validation"         } }        }    }  }  1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.44.45.46.47.48.49.50.51.52.53.54.55.56.57.58.59.60.61.62.63.64.65.66.67.68.69.70.71.72.73.74.75.76.77.78.79.80.81.82.83.84.85.86.
copyright © 2025 powered by 编程之道  滇ICP备2023006006号-34sitemap