From 845bdb936f57924828d95225fa7e4d4f9238d5a0 Mon Sep 17 00:00:00 2001 From: Ray Smets Date: Mon, 8 Aug 2022 08:45:28 -0700 Subject: [PATCH] [CI] updated (#65) --- .circleci/config.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e1cc9e6..b5cded0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -149,6 +149,9 @@ jobs: type: string deployment: type: string + namespace: + type: string + default: default docker: # Referencing the python image here, see https://github.com/CircleCI-Public/aws-eks-orb/issues/52#issuecomment-1006838213 - image: cimg/python:3.10 steps: @@ -159,7 +162,10 @@ jobs: cluster-name: << parameters.cluster-name >> - run: command: | - kubectl set image deployment/<< parameters.deployment >> << parameters.deployment >>=${AWS_ECR_URL}/<< parameters.repo >>:"dev-${CIRCLE_BRANCH}-${CIRCLE_PREVIOUS_BUILD_NUM}" + # Set the image tag then ensure a rollout is triggered. Thanks to the deployment pod spec being set to always pull this should grab the latest image, even with the same tag. + # ref: https://stackoverflow.com/a/55914480/2631728 + kubectl set image deployment/<< parameters.deployment >> << parameters.deployment >>=${AWS_ECR_URL}/<< parameters.repo >>:"dev-latest" -n << parameters.namespace >> + kubectl rollout restart deploy << parameters.deployment >> -n << parameters.namespace >> # Check deployment rollout status every 10 seconds (max 10 minutes) until complete. # ref: https://www.jeffgeerling.com/blog/2018/updating-kubernetes-deployment-and-waiting-it-roll-out-shell-script @@ -201,7 +207,10 @@ jobs: cluster-name: << parameters.cluster-name >> - run: command: | + # Set the image tag then ensure a rollout is triggered. Thanks to the deployment pod spec being set to always pull this should grab the latest image, even with the same tag. + # ref: https://stackoverflow.com/a/55914480/2631728 kubectl set image deployment/<< parameters.deployment >> << parameters.deployment >>=${AWS_ECR_URL}/<< parameters.repo >>:sandbox-"${CIRCLE_TAG}" -n << parameters.namespace >> + kubectl rollout restart deploy << parameters.deployment >> -n << parameters.namespace >> # Check deployment rollout status every 10 seconds (max 10 minutes) until complete. # ref: https://www.jeffgeerling.com/blog/2018/updating-kubernetes-deployment-and-waiting-it-roll-out-shell-script