diff --git a/Jenkinsfile b/Jenkinsfile index 3ac7d5747..fbc946996 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,8 @@ 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" + 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 { } } } -} \ No newline at end of file + post { + cleanup { + kubernetesDeploy ( + kubeconfigId: 'kubeconfig', + configs: 'train-schedule-kube-canary.yml', + enableConfigSubstitution: true + ) + } + } +} 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