Jenkins Pipeline ample 样板

pipeline{
    environment{
        localPath = '/Users/jasqia/Desktop'
    }
    agent:any
    stages{
        stage("Stage 1"){
            steps {
                script{
                    buildDescription '<span>PYTHON_ENV: ${PYTHON_ENV} <br/> USERNAME: ${AUTO_USERNAME}  <br/> BUCKET:${CLIENT_BUCKET}</span>'
                }
            }

        }
        stage("Stage 2"){
            steps {
                echo 'It is pulling code for remote qe github...'
                script{
                    checkout([$class: 'GitSCM', branches: [[name: 'jasQian']],userRemoteConfigs: [[credentialsId: '03ed9bf8-701d-4270-a1e8-a6aa1e74c9f6', url: 'git@github.com:xxx.git']]])
                }
            }

        }
        stage("Stage 3"){
            steps {
                echo 'copy application.properties....'
                script{
                    def workspace = pwd()
                    sh """cp -f ${localPath}/application.properties ${workspace}/src/main/resources/"""
                }
            }

        }
        stage("Stage 4"){
            steps {
                echo 'mvn package....'
                script{
                    sh ' /usr/local/Cellar/maven/3.8.1/libexec/bin/mvn package'
                }
            }

        }
    }
    post {
        always {
            cleanWs()
        }
    }

}
    

 

posted @ 2021-07-16 18:17  巴黎爱工作  阅读(71)  评论(0编辑  收藏  举报