Jenkins Pipeline

            jenkins + pipeline构建自动化部署

            pipeline {
               agent any
               tools { 
                    maven 'maventool'
               }
               stages {
                  stage ('初始化') {
                        steps {
                            sh '''
                                echo "PATH = ${PATH}"
                                echo "M2_HOME = ${M2_HOME}"
                            ''' 
                        }
                    }
                 stage('拉取代码') { // for display purposes
                   steps {
                       git branch: 'release-2.0', credentialsId: '7cb3c8ca-b916-49eb-95fc-be3b243c3a93', url: 'http://url:9080/Shtel-PaaS/Shtel-PaaS-DevOps/paas-devops-pipeline.git'
                       sh 'git checkout v2.0.1'     
                    }
                 }
                 stage('maven构建') {
                   steps {
                       // Run the maven build
                       sh "mvn clean -U package -Dmaven.test.skip=true"
                   }
                 }
                 stage('拉取部署剧本') { // for display purposes
                   steps {
                       sh "rm -rf paas-svc-k8s-deploy-playbook"
                       
                       dir("paas-svc-k8s-deploy-playbook") {
                           git branch: 'dev', credentialsId: '7cb3c8ca-b916-49eb-95fc-be3b243c3a93', url: 'http://url:9080/configserver/paas-svc-k8s-deploy-playbook.git'
                        //   sh 'git checkout v0.1'
                       }
                    }
                 }
                 stage('拉取配置集'){  // for desplay purposes
                  steps {
                    sh "rm -rf deploy_config_set"
                    dir("deploy_config_set"){
                      git branch: 'dev', credentialsId: '7cb3c8ca-b916-49eb-95fc-be3b243c3a93', url: 'http://url:9080/configserver/deploy_config_set'
                    }
                  }
                 }
                 stage('放置发布包') {
                   steps {
                       sh "cp target/*.tar.gz paas-svc-k8s-deploy-playbook/roles/paas-svc/files"
                   }
                 }
                 stage('根据包,修改脚本中的版本号'){
                  steps{
                     sh "sh paas-svc-k8s-deploy-playbook/roles/paas-svc/templates/set_version.sh"
                  }
                 }
                 stage('执行部署') {
                   steps {
                     ansiblePlaybook credentialsId: 'paas-ce-77', extras: '--extra-vars=\'@./deploy_config_set/paas-devops-pipeline/dev.yml\' -e "env=dev"', installation: 'ansible-playbook', inventory: 'paas-svc-k8s-deploy-playbook/inventory/inventory', playbook: 'paas-svc-k8s-deploy-playbook/playbooks/deploy-dev-k8s.yml'
                   }
                 }
               }
            }
            
            
            
            # -----------------------------------------------------------------------------------------------------
            
            
            pipeline {
               agent any
               tools { 
                    maven 'maventool'
               }
               stages {
                  stage ('初始化') {
                        steps {
                            sh '''
                                echo "PATH = ${PATH}"
                                echo "M2_HOME = ${M2_HOME}"
                            ''' 
                        }
                    }
                 stage('拉取devops-common代码') {
                   steps {
                       sh "rm -rf *"
                       git branch: 'release-2.0', credentialsId: '7cb3c8ca-b916-49eb-95fc-be3b243c3a93', url: 'http://url:9080/Shtel-PaaS/Shtel-PaaS-DevOps/paas-devops-common.git'
                       sh 'git checkout v2.0.1' 
                    }
                 }
                 stage('maven构建devops-common包') {
                   steps {
                       sh "mvn clean deploy -DaltDeploymentRepository=paas::default::http://url:8082/repository/maven-snapshots/"
                   }
                 }
            
               }
            }
            相关文章
            相关标签/搜索
            每日一句
              每一个你不满意的现在,都有一个你没有努力的曾经。
            公众号推荐
               一个历史类的公众号,欢迎关注
            一两拨千金
            王中王鉄算盘开奖结果小说 界首市| 牟定县| 咸宁市| 新竹县| 丘北县| 扶沟县| 大安市| 彩票| 蒙阴县| 东乌| 涿州市| 东平县| 赣州市| 虞城县| 富川| 阿拉善右旗| 沙湾县| 曲水县| 法库县| 藁城市| 青田县| 五寨县| 沧州市| 扎赉特旗| 唐海县| 镇安县| 邢台市| 犍为县| 云和县| 合阳县| 周至县| 上饶县| 同江市| 扶余县| 白山市| 揭东县| 望江县| http://fa.hz0j2r1vo.fun http://fa.hz0j1r8vo.fun http://fa.hz0j1r0vo.fun http://fa.hz0j1r5vo.fun http://fa.hz0j0r3vo.fun