From 01fdbdf63f36f24cb8b9ce59153cff2d3b301419 Mon Sep 17 00:00:00 2001 From: Ray Smets Date: Wed, 6 Jul 2022 22:23:45 -0700 Subject: [PATCH] [HV & CI] HV sdk version bump from 4.1.1 to 4.1.6. CI updated to allow for same image tag deployments. (#12) * [HV] sdk version bump from 4.1.1 to 4.1.6. * [CI] fix. --- .circleci/config.yml | 50 ++++++++++++++++++++++++++++++++++++++++++-- public/index.html | 2 +- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0ede5d4..d5880eb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -274,7 +274,53 @@ jobs: cluster-name: << parameters.cluster-name >> - run: command: | - kubectl set image deployment/<< parameters.deployment >> << parameters.deployment >>=${AWS_ECR_URL}/<< parameters.repo >>:"${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" + kubectl rollout restart deploy << parameters.deployment >> + + # 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 + ATTEMPTS=0 + ROLLOUT_STATUS_CMD="kubectl rollout status deployment/<< parameters.deployment >>" + until $ROLLOUT_STATUS_CMD || [ $ATTEMPTS -eq 60 ]; do + $ROLLOUT_STATUS_CMD + ATTEMPTS=$((attempts + 1)) + sleep 10 + done + name: Deploy container image to dev + - slack/notify: + event: fail + mentions: '@devops-team' + template: basic_fail_1 + - slack/notify: + event: pass + template: basic_success_1 + + deploy-image-test: + docker: # Referencing the python image here, see https://github.com/CircleCI-Public/aws-eks-orb/issues/52#issuecomment-1006838213 + - image: cimg/python:3.10 + parameters: + cluster-name: + type: string + default: "dev-customer-cluster" + repo: + type: string + deployment: + type: string + + steps: + - kubernetes/install + - aws-eks/update-kubeconfig-with-authenticator: + install-kubectl: true + aws-region: ${AWS_REGION} + 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 >>:"test-latest" + kubectl rollout restart deploy << parameters.deployment >> # 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 @@ -444,7 +490,7 @@ workflows: branches: only: - test-circleci - - deploy-image: + - deploy-image-test: name: "deploy-id-verification-demo-test" context: - AWS-Dev diff --git a/public/index.html b/public/index.html index 2d6e53f..53433c3 100644 --- a/public/index.html +++ b/public/index.html @@ -26,7 +26,7 @@ --> ACME - +