From 92dde014363f105de0a6356079c6aa8c7c141cce Mon Sep 17 00:00:00 2001 From: Jonny Ervine Date: Mon, 2 Mar 2020 09:33:26 +0000 Subject: [PATCH] modified: Jenkinsfile Updated to auto-deploy to k8s --- Jenkinsfile | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2e7380c..7d25237 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/mariadb" - stage "build" - def app = docker.build "library/x86_64/alpine/mariadb" - - 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 db delete po mariadb-0" + } + } + catch (err) { + currentBuild.result = 'FAILURE' + } } }