From 83b886d82a8830e3e7bfbd611944c94b629e38ef Mon Sep 17 00:00:00 2001 From: Jonny Ervine Date: Fri, 28 Feb 2020 09:28:46 +0000 Subject: [PATCH] modified: Jenkinsfile Set Jenkins to auto deploy to k8s on build --- Jenkinsfile | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 70f0750..8f4f4ef 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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/tautulli" - stage "build" - def app = docker.build "library/x86_64/alpine/tautulli" - - 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 tautulli-0" + } + } + catch (err) { + currentBuild.result = 'FAILURE' + } } }