jenkins pipeline




pipeline {

    agent any
    options {
        timestamps()
    }
    parameters {
        string(name:'BUILD_PARA',defaultValue: '-j 16')
        booleanParam(name:'RUN_UAT_TEST',defaultValue:true)
    }
    environment {
        RUN_UAT_TEST = "${params.RUN_UAT_TEST}"
    }
    stages {
            stage("Build"){
                steps{
                    sh 'printenv'
                    echo 'this is a build step'
                    echo 'build parameters is ${BUILD_PARA}'
                }
            }
            stage("TEST"){
                parallel {
                stage('Test1'){
                    steps{
                        echo "this is a test1 step"
                    }
                }
                stage('Test2'){
                    steps{
                        echo "this is a test1 step"
                    }
                }
                }
            }


            stage('UAT test'){
                when{
                    environment name: 'RUN_UAT_TEST',value:'true'
                }
                steps{
                   echo 'this is a uat test'
                }
            
            }
            
            stage('Deploy'){
                steps{
                    echo "this is a test step"
                    script {
                        env.RELEASE_SCOPE = input message: '请选择发布类型',ok: 'Release',
                        parameters: [choice(name: 'RELEASE_SCOPE',choices: '开发环境\n测试环境\n生产环境')]
                        
                    }
                    
                    
                }
                post {
                    failure {
                        echo "email sobody"
                    }
                    success {
                        echo "success!!!"
                    }
                    aborted {
                        echo "interriput"
                    }    
                    
                }
            }
            
        }        

}






##################################

pipeline {
    agent any
    options {
        timestamps()
    }
    stages {
            stage("Build"){
                steps{
                    echo 'this is a build step'
                }
            }
            stage("TEST"){
                parallel {
                stage('Test1'){
                    steps{
                        echo "this is a test1 step"
                    }
                }
                stage('Test2'){
                    steps{
                        echo "this is a test1 step"
                    }
                }
                }
            }


            
            
            
            
            stage('Deploy'){
                steps{
                    echo "this is a test step"
                }
                post {
                    failure {
                        echo "email sobody"
                    }
                    success {
                        echo "success!!!"
                    }
                    aborted {
                        echo "interriput"
                    }    
                    
                }
            }
            
        }
        


}

猜你喜欢

转载自blog.csdn.net/weixin_38098312/article/details/80365714