grovvy pipeline 部署

pipeline {
    agent any
    stages {
        stage('Checkout') {
            steps {
                echo 'Checkout'
                checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '15d8b7a3-ffa8-4fdc-a3bb-d4e2a1c741d8', url: 'git@git.cinyi.com:family-doctor/fd-admin.git']]])
            }
        }        

        stage('sonar质量管理') {
            steps {
                echo 'sonar质量管理'
                sh 'mvn clean verify sonar:sonar' 
            }
        }
        
        stage('mvn构建') {
            steps {
                echo 'Building'
                sh "mvn clean package -DskipTests -Dmaven.test.skip=true" 
            }
        }
        
        stage('Deploy') {
            steps {
                echo 'Deploying'
                 sh "scp /root/.jenkins/workspace/family_Doctor_service_Version_deployment_new/family-web/target/*.tar.gz  root@192.168.20.197:/data/code/" 
                sh 'ssh root@192.168.20.197 "/data/auto_pub.sh admin"'
            }
        }
    }
}

 

posted @ 2017-10-24 16:59  fengjian1585  阅读(301)  评论(0编辑  收藏  举报