Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit 27f9aa3

Browse files
authored
Add blue/green deployment (#3291)
We don't want to break the current release pipeline, the whole "for.." section in k8s_deploy will be deleted after manually switch traffic to AWS EKS blue/green deployment and change staging DNS from Alicloud cluster to AWS EKS
1 parent 69643f4 commit 27f9aa3

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

.circleci/config.yml

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,18 @@ commands:
8080
docker_build_push:
8181
description: "Build and Push image to docker hub"
8282
parameters:
83-
target:
83+
docker_latest_image_tag:
84+
type: string
85+
default: "latest-staging"
86+
docker_image_tag:
8487
type: string
88+
default: ${CIRCLE_SHA1}
8589
steps:
8690
- setup_remote_docker
8791
- run:
88-
name: Building docker image for << parameters.target >>
92+
name: Building docker image for << parameters.docker_latest_image_tag >>
8993
command: |
90-
build_latest="latest"
91-
[ "<< parameters.target >>" == "beta" ] && build_latest="beta-latest"
92-
docker build -t ${DOCKHUB_ORGANISATION}/binary-static-bot:${CIRCLE_TAG} -t ${DOCKHUB_ORGANISATION}/binary-static-bot:${build_latest} .
94+
docker build -t ${DOCKHUB_ORGANISATION}/binary-static-bot:<< parameters.docker_image_tag >> -t ${DOCKHUB_ORGANISATION}/binary-static-bot:<< parameters.docker_latest_image_tag >> .
9395
- run:
9496
name: Pushing Image to docker hub
9597
command: |
@@ -100,6 +102,13 @@ commands:
100102
parameters:
101103
target:
102104
type: string
105+
default: "beta"
106+
k8s_version:
107+
type: string
108+
default: ${CIRCLE_SHA1}
109+
k8s_namespace:
110+
type: string
111+
default: "bot-binary-com-staging"
103112
steps:
104113
- k8s/install-kubectl
105114
- run:
@@ -122,6 +131,12 @@ commands:
122131
kubectl --server=${KUBE_SERVER} --certificate-authority=ca.crt --token=$SERVICEACCOUNT_TOKEN set image deployment/${deployment_target} ${deployment_target}=${DOCKHUB_ORGANISATION}/binary-static-bot:${CIRCLE_TAG}
123132
fi
124133
done
134+
135+
export NAMESPACE=<< parameters.k8s_namespace >>
136+
git clone https://github.com/binary-com/devops-ci-scripts
137+
cd devops-ci-scripts/k8s-build_tools
138+
echo $CA_CRT | base64 --decode > ca.crt
139+
./release.sh binary-static-bot << parameters.k8s_version >>
125140
test:
126141
description: "Run test"
127142
steps:
@@ -154,21 +169,12 @@ jobs:
154169
- npm_install
155170
- test
156171
- build
172+
- docker_build_push
157173
- deploy:
158174
target_branch: "staging"
175+
- k8s_deploy
159176
- notify_slack
160177
release_production:
161-
docker:
162-
- image: circleci/node:8.10.0-stretch
163-
steps:
164-
- git_checkout_from_cache
165-
- npm_install
166-
- test
167-
- build
168-
- deploy:
169-
target_branch: "production"
170-
- notify_slack
171-
release_aws_production:
172178
docker:
173179
- image: circleci/node:12.13.0-stretch
174180
steps:
@@ -177,9 +183,12 @@ jobs:
177183
- test
178184
- build
179185
- docker_build_push:
180-
target: "production"
186+
docker_latest_image_tag: latest
187+
docker_image_tag: ${CIRCLE_TAG}
181188
- k8s_deploy:
182189
target: "production"
190+
k8s_namespace: "bot-binary-com-production"
191+
k8s_version: ${CIRCLE_TAG}
183192

184193
workflows:
185194
test:
@@ -200,10 +209,4 @@ workflows:
200209
ignore: /.*/
201210
tags:
202211
only: /^production.*/
203-
- release_aws_production:
204-
filters:
205-
branches:
206-
ignore: /.*/
207-
tags:
208-
only: /^production.*/
209212
context: binary-frontend-artifact-upload

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy