modified: Jenkinsfile

Added automatic k8s deployment
This commit is contained in:
Jonny Ervine 2020-02-28 09:18:17 +00:00
parent f0a285f3c9
commit 4ee1b8e139

21
Jenkinsfile vendored
View File

@ -6,12 +6,21 @@ node("docker-node") {
sh "git rev-parse HEAD > .git/commit-id"
def commit_id = readFile('.git/commit-id').trim()
println commit_id
try {
stage "build"
def app = docker.build "library/x86_64/alpine/watcher"
stage "build"
def app = docker.build "library/x86_64/alpine/watcher"
stage "publish"
app.push("${env.BUILD_NUMBER}")
app.push("latest")
stage "publish"
app.push("${env.BUILD_NUMBER}")
app.push("latest")
stage('Deploy on k8s'){
sh "/usr/local/bin/kubectl -n media delete po watcher-0"
}
}
catch (err) {
currentBuild.result = 'FAILURE'
}
}
}