From d12204cc5da944ae7088dd46376eadd8c55e303b Mon Sep 17 00:00:00 2001 From: Jonny Ervine Date: Sat, 14 Mar 2020 14:36:48 +0000 Subject: [PATCH] modified: Jenkinsfile Added k8s deploy command to build --- Jenkinsfile | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 46c888f..cf256b6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,12 +6,22 @@ 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/sonarr" - stage "build" - def app = docker.build "library/x86_64/alpine/sonarr" - - stage "publish" - app.push("${env.BUILD_NUMBER}") - app.push("latest") + stage "publish" + app.push("${env.BUILD_NUMBER}") + app.push("v2.0.0.5322") + app.push("latest") + + stage('Deploy on K8s'){ + sh "/usr/local/bin/kubectl -n media delete po sonarr-0" + } + } + catch (err) { + currentBuild.result = 'FAILURE' + } } }