Skip to content
Open

test #81

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 29 additions & 11 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "mukeshmossy19/train-schedule"
CANARY_REPLICAS = 0
}
stages {
stage('Build') {
Expand Down Expand Up @@ -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',
Expand All @@ -76,4 +85,13 @@ pipeline {
}
}
}
}
post {
cleanup {
kubernetesDeploy (
kubeconfigId: 'kubeconfig',
configs: 'train-schedule-kube-canary.yml',
enableConfigSubstitution: true
)
}
}
}
2 changes: 1 addition & 1 deletion train-schedule-kube-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:

---

apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: train-schedule-deployment-canary
Expand Down
2 changes: 1 addition & 1 deletion train-schedule-kube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:

---

apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: train-schedule-deployment
Expand Down