jenkins 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 sonar:sonar'
            }
        }
        
        stage('mvn构建') {
            steps {
                echo 'Building'
                sh "mvn clean package -DskipTests -Dmaven.test.skip=true"
            }
        }
        
        stage('Deploy') {
            steps {
                echo 'Deploying'
                 sh "scp $WORKSPACE/target/*.war  root@192.168.20.197:/data/code/" 
                sh 'ssh root@192.168.20.197 "/data/auto_pub.sh admin"'
            }
        }
    }
}

 

posted @ 2017-10-30 10:41  fengjian1585  阅读(534)  评论(0编辑  收藏  举报