jenkins pipeline input 参数选择发布不通环

2020-07-27  本文已影响0人  _fishman
pipeline {
    agent any
    stages {
        stage("test") {
            steps {
                timeout(time: 1, unit: 'MINUTES') {
                script {
                    env.DEPLOY_ENV = input message: '选择部署的环境', ok: 'deploy',
                        parameters: [choice(name: 'DEPLOY_ENV', choices: ['prd', 'uat', 'test'], description: '选择部署环境')]

                        switch("${env.DEPLOY_ENV}"){
                            case 'prd':
                                println('deploy prd env')
                                break;

                            case 'uat':
                                println('deploy uat env')
                                break;

                            case 'test':
                                println('deploy test env')
                                break;
                            
                            default:
                                println('error env')

                        }
                    }
                }
            }
        }
    }
}
上一篇下一篇

猜你喜欢

热点阅读