From d056191b01bb5acc666fb67cf6eaabad1bfef845 Mon Sep 17 00:00:00 2001 From: dandds Date: Wed, 17 Jul 2019 15:24:04 -0400 Subject: [PATCH] Working config for CD. This adds the AWS and Azure CircleCI orbs for updating container images in a cluster. It installs the clients for both CSPs, configures kubectl with a programmatic user's auth information, and executes a `kubectl set image` command to reset the cluster image to the one that was just pushed to the container registry. --- .circleci/config.yml | 76 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b9d73612..13a081fe 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,9 @@ version: 2.1 orbs: aws-ecr: circleci/aws-ecr@4.0.1 + aws-eks: circleci/aws-eks@0.1.0 azure-acr: circleci/azure-acr@0.1.1 + azure-aks: circleci/azure-aks@0.2.0 defaults: appEnvironment: &appEnvironment @@ -83,15 +85,6 @@ workflows: - test: requires: - app_setup - - aws-ecr/build_and_push_image: - repo: atat - tag: "${CIRCLE_SHA1}" - requires: - - test - filters: - branches: - only: - - master - azure-acr/build_and_push_image: login-server-name: "${AZURE_SERVER_NAME}" registry-name: pwatat @@ -103,3 +96,68 @@ workflows: branches: only: - master + - azure-aks/update-container-image: + cluster-name: atat-cluster + container-image-updates: "atst=${AZURE_SERVER_NAME}/atat:${CIRCLE_SHA1}" + namespace: atat + resource-name: deployment.apps/atst + resource-group: atat + # uncomment below for debugging + # show-kubectl-command: true + requires: + - azure-acr/build_and_push_image + filters: + branches: + only: + - master + - azure-aks/update-container-image: + cluster-name: atat-cluster + container-image-updates: "atst-worker=${AZURE_SERVER_NAME}/atat:${CIRCLE_SHA1}" + namespace: atat + resource-name: deployment.apps/atst-worker + resource-group: atat + # uncomment below for debugging + # show-kubectl-command: true + requires: + - azure-acr/build_and_push_image + filters: + branches: + only: + - master + - aws-ecr/build_and_push_image: + repo: atat + tag: "${CIRCLE_SHA1}" + requires: + - test + filters: + branches: + only: + - master + - aws-eks/update-container-image: + cluster-name: atat + container-image-updates: "atst=${AWS_ECR_ACCOUNT_URL}/atat:${CIRCLE_SHA1}" + namespace: atat + resource-name: deployment.apps/atst + aws-region: "${AWS_REGION}" + # uncomment below for debugging + # show-kubectl-command: true + requires: + - aws-ecr/build_and_push_image + filters: + branches: + only: + - master + - aws-eks/update-container-image: + cluster-name: atat + container-image-updates: "atst-worker=${AWS_ECR_ACCOUNT_URL}/atat:${CIRCLE_SHA1}" + namespace: atat + resource-name: deployment.apps/atst-worker + aws-region: "${AWS_REGION}" + # uncomment below for debugging + # show-kubectl-command: true + requires: + - aws-ecr/build_and_push_image + filters: + branches: + only: + - master