From 1bd1ecfc7fbb001d229138418503b967a1585869 Mon Sep 17 00:00:00 2001 From: Man Sinh LE <110429962+man-sinh-le@users.noreply.github.com> Date: Tue, 20 Sep 2022 10:40:42 +0700 Subject: [PATCH 1/3] Update Jenkinsfile with docker hub unixmandockerhub --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3ac7d5747..7a041d24b 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 = "unixmandockerhub/train-schedule" } stages { stage('Build') { @@ -76,4 +76,4 @@ pipeline { } } } -} \ No newline at end of file +} From 57e43f86ce61304715b1a516041fe26a80c16db1 Mon Sep 17 00:00:00 2001 From: Man Sinh LE <110429962+man-sinh-le@users.noreply.github.com> Date: Tue, 20 Sep 2022 10:52:44 +0700 Subject: [PATCH 2/3] Update Jenkinsfile with smoke test --- Jenkinsfile | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7a041d24b..fbc946996 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 = "unixmandockerhub/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 + ) + } + } } From fe27a773108918455845c8b01156d4812f6e63e0 Mon Sep 17 00:00:00 2001 From: Man Sinh LE <110429962+man-sinh-le@users.noreply.github.com> Date: Tue, 20 Sep 2022 11:16:00 +0700 Subject: [PATCH 3/3] update --- views/index.jade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/index.jade b/views/index.jade index 6e6be7155..e285488ff 100644 --- a/views/index.jade +++ b/views/index.jade @@ -10,4 +10,4 @@ block content #trainInfo strong #trainSchedule - strong Select a train to view its current schedule. \ No newline at end of file + strong Select a train to view its current schedule. Fuck You All