jenkinsfile 内容,使用rsync 增量发布
pipeline {
agent any
stages {
stage('Clone') {
steps {
git credentialsId: '577c3f73-6c57-4ae8-a5c3-4ec1e97f413e', url: 'https://gitee.com/xx.git'
}
}
stage('CopyEnv') {
steps {
sh "mv .env.production .env"
}
}
stage('CopyFile ') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'e9466b37-ba1e-4508-8cce-84b8fa3b5c1e', keyFileVariable: 'pem')]) {
sh '''
#scp -i ${pem} -o "StrictHostKeyChecking=no" -r . ecs-user@8.211.50.150:/www/wwwroot/cn/supplier/production/newcurrent2/
rsync -avzP --exclude=.git --delete -e "ssh -i ${pem} -o StrictHostKeyChecking=no" . ecs-user@127.0.0.1:/www/wwwroot/production/
'''
}
}
}
}
}