调整完善adminapi的jenkins构建脚本
This commit is contained in:
Vendored
-31
@@ -1,31 +0,0 @@
|
||||
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'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
stage('deploy') {
|
||||
def remote = [:]
|
||||
remote.name = "node-1"
|
||||
remote.host = "130.120.3.231"
|
||||
remote.allowAnyHosts = true
|
||||
|
||||
steps {
|
||||
withCredentials([sshUserPrivateKey(credentialsId: 'e41b57a4-436a-4617-817c-9e3f25a8a47f', keyFileVariable: 'identity', passphraseVariable: '', usernameVariable: 'userName')]) {
|
||||
sshCommand remote: remote, command: 'docker stop adminapi'
|
||||
}
|
||||
sh 'echo deploy'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
node {
|
||||
checkout scm
|
||||
docker.image('maven:3-alpine').inside('-v /root/.m2:/root/.m2') {
|
||||
stage('build'){
|
||||
sh 'mvn clean package dockerfile:build dockerfile:push -Dmaven.test.skip=true'
|
||||
}
|
||||
|
||||
stage('deploy'){
|
||||
def remote = [:]
|
||||
remote.name = "airport-dev"
|
||||
remote.host = "130.120.3.231"
|
||||
remote.allowAnyHosts = true
|
||||
|
||||
withCredentials([sshUserPrivateKey(credentialsId: 'e41b57a4-436a-4617-817c-9e3f25a8a47f', keyFileVariable: 'kfIdentity', passphraseVariable: 'pVariable', usernameVariable: 'userName')]) {
|
||||
remote.user = userName
|
||||
remote.identityFile = kfIdentity
|
||||
|
||||
sshCommand remote: remote, command: "docker stop adminapi",sudo: true ,failOnError: false
|
||||
sshCommand remote: remote, command: "docker rm adminapi",sudo: true ,failOnError: false
|
||||
sshCommand remote: remote, command: "docker rmi 130.120.3.193/com.gzzn.omms/admin-api:0.0.1-SNAPSHOT",sudo: true ,failOnError: false
|
||||
sshCommand remote: remote, command: "docker pull 130.120.3.193/com.gzzn.omms/admin-api:0.0.1-SNAPSHOT" ,sudo: true
|
||||
sshCommand remote: remote, command: "docker run -d -p 91:8080 --name adminapi 130.120.3.193/com.gzzn.omms/admin-api:0.0.1-SNAPSHOT",sudo: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user