2018-11-04 13:54:32 +08:00
|
|
|
pipeline {
|
|
|
|
|
agent {
|
|
|
|
|
docker {
|
|
|
|
|
image 'maven:3-alpine'
|
|
|
|
|
args '-v /root/.m2:/root/.m2'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
stages {
|
|
|
|
|
stage('build') {
|
|
|
|
|
steps {
|
|
|
|
|
sh 'mvn clean package dockerfile:build dockerfile:push -Dmaven.test.skip=true'
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-11-04 14:59:22 +08:00
|
|
|
|
2018-11-04 18:47:59 +08:00
|
|
|
|
2018-11-04 14:59:22 +08:00
|
|
|
stage('deploy') {
|
2018-11-04 18:47:59 +08:00
|
|
|
def remote = [:]
|
|
|
|
|
remote.name = "node-1"
|
|
|
|
|
remote.host = "130.120.3.231"
|
|
|
|
|
remote.allowAnyHosts = true
|
|
|
|
|
|
2018-11-04 14:59:22 +08:00
|
|
|
steps {
|
2018-11-04 18:47:59 +08:00
|
|
|
withCredentials([sshUserPrivateKey(credentialsId: 'e41b57a4-436a-4617-817c-9e3f25a8a47f', keyFileVariable: 'identity', passphraseVariable: '', usernameVariable: 'userName')]) {
|
|
|
|
|
sshCommand remote: remote, command: 'docker stop adminapi'
|
|
|
|
|
}
|
|
|
|
|
sh 'echo deploy'
|
2018-11-04 14:59:22 +08:00
|
|
|
}
|
|
|
|
|
}
|
2018-11-04 13:54:32 +08:00
|
|
|
}
|
|
|
|
|
}
|