From 778f7b3ee34d6dceb69af6afb8f01f3fd5f7ba20 Mon Sep 17 00:00:00 2001 From: whboyd Date: Mon, 24 Jun 2019 09:45:55 -0400 Subject: [PATCH 1/4] Update train-schedule-kube.yml --- train-schedule-kube.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train-schedule-kube.yml b/train-schedule-kube.yml index 0222f1bc1..539f8e28f 100644 --- a/train-schedule-kube.yml +++ b/train-schedule-kube.yml @@ -13,7 +13,7 @@ spec: --- -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: train-schedule-deployment From 37d1895bfc616c466538505545cfec6342c298c5 Mon Sep 17 00:00:00 2001 From: whboyd Date: Mon, 24 Jun 2019 09:46:17 -0400 Subject: [PATCH 2/4] Update train-schedule-kube-canary.yml --- train-schedule-kube-canary.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train-schedule-kube-canary.yml b/train-schedule-kube-canary.yml index 9922ce94b..697f891e8 100644 --- a/train-schedule-kube-canary.yml +++ b/train-schedule-kube-canary.yml @@ -14,7 +14,7 @@ spec: --- -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: train-schedule-deployment-canary From 67a8229da02f3331fefb7f48d739c9ef45aec686 Mon Sep 17 00:00:00 2001 From: Mukesh <103170427+Mossy1927@users.noreply.github.com> Date: Thu, 28 Jul 2022 11:36:42 +0530 Subject: [PATCH 3/4] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3ac7d5747..dbee05fff 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ pipeline { agent any environment { //be sure to replace "willbla" with your own Docker Hub username - DOCKER_IMAGE_NAME = "willbla/train-schedule" + DOCKER_IMAGE_NAME = "mukeshmossy19/train-schedule" } stages { stage('Build') { @@ -76,4 +76,4 @@ pipeline { } } } -} \ No newline at end of file +} From 7e2384bd69798078febe5ae37a978cd67d5073c1 Mon Sep 17 00:00:00 2001 From: Mukesh <103170427+Mossy1927@users.noreply.github.com> Date: Thu, 28 Jul 2022 11:59:10 +0530 Subject: [PATCH 4/4] Update Jenkinsfile --- Jenkinsfile | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index dbee05fff..b64e8d336 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,6 +3,7 @@ pipeline { environment { //be sure to replace "willbla" with your own Docker Hub username DOCKER_IMAGE_NAME = "mukeshmossy19/train-schedule" + CANARY_REPLICAS = 0 } stages { stage('Build') { @@ -53,21 +54,29 @@ pipeline { ) } } - stage('DeployToProduction') { + stage('SmokeTest') { when { branch 'master' } - environment { - CANARY_REPLICAS = 0 + steps { + script { + sleep (time: 5) + def response = httpRequest ( + url: "http://$KUBE_MASTER_IP:8081/", + timeout: 30 + ) + if (response.status != 200) { + error("Smoke test against canary deployment failed.") + } + } + } + } + stage('DeployToProduction') { + when { + branch 'master' } steps { - input 'Deploy to Production?' milestone(1) - kubernetesDeploy( - kubeconfigId: 'kubeconfig', - configs: 'train-schedule-kube-canary.yml', - enableConfigSubstitution: true - ) kubernetesDeploy( kubeconfigId: 'kubeconfig', configs: 'train-schedule-kube.yml', @@ -76,4 +85,13 @@ pipeline { } } } + post { + cleanup { + kubernetesDeploy ( + kubeconfigId: 'kubeconfig', + configs: 'train-schedule-kube-canary.yml', + enableConfigSubstitution: true + ) + } + } }