Pipeline提交、测试、部署流程 一、提交阶段:1.更新代码 2.构建 3.单元测试 4.质量扫描 node { gitlabCommitStatus(builds:["Commit Build"]){ stage('Code PUll'){ echo "Code PUll" git credentialsId: '10ca77b0-5bcc-4aa7-9f26-b27a5d557f7a', url: 'http://192.168.56.12/devops/account.git' } stage('Code Build'){ echo "code Build" sh '/root/mvn/apache-maven-3.5.2/bin/mvn clean compile' } stage('Unit Test'){ echo "Unit test" } } } 二、集成测试阶段:1.更新代码 2.构建 3.单元测试 4.质量扫描 5.打包 6.部署到测试环境 7.自动化api测试 node { stage('Code PUll'){ echo "Code PUll" git credentialsId: '10ca77b0-5bcc-4aa7-9f26-b27a5d557f7a', url: 'http://192.168.56.12/devops/account.git' } stage('Code Build'){ echo "code Build" sh '/root/mvn/apache-maven-3.5.2/bin/mvn clean compile' } stage('Unit Test'){ echo "Unit test" sh '/root/mvn/apache-maven-3.5.2/bin/mvn test' } stage('Package'){ echo "Package" sh '/root/mvn/apache-maven-3.5.2/bin/mvn package' } stage('Deploy Test ENV'){ echo "Deploy Test ENV" sh 'ls -la ./account-service/target/' } stage('AUto API TEst'){ echo "TEST" } } 三、部署阶段:用户输入参数,调用脚本自动化部署 参数化构建过程 node { stage('Deploy'){ echo "Code Deploy Prod" sh '/opt/test.sh ${ENV} ${GROUP} ${PROJECT} ${VERSION}' } }
标签:pipeline,Code,流程,echo,sh,Build,mvn,stage From: https://www.cnblogs.com/ruiy/p/16858508.html