From 6814b79c9f7ef7c151ddec0dc88d330693e41a12 Mon Sep 17 00:00:00 2001 From: Brian Vu <64455338+brivu@users.noreply.github.com> Date: Fri, 28 Jul 2023 14:45:18 -0700 Subject: [PATCH] fix: minor PR issues (#202) * chore: correct filename typo * fix: add profile to code deploy green blue deployments * fix: change conditional from 1 to true --- .circleci/test-deploy.yml | 29 ++++++++++--------- ...ent.yml => verify_revision_deployment.yml} | 0 .../update_bluegreen_service_via_task_def.sh | 6 ++-- 3 files changed, 19 insertions(+), 16 deletions(-) rename src/examples/{verify_revision_deplopyment.yml => verify_revision_deployment.yml} (100%) diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index 518c0fc3..b2c65c56 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -146,13 +146,18 @@ jobs: role_arn: type: string default: '' + skip-creation-env: + type: boolean + default: false docker: - image: << parameters.terraform-image >> steps: - run: name: Check if test env should be set up + environment: + SKIP_TEST_ENV_CREATION: <> command: | - if [ "${SKIP_TEST_ENV_CREATION}" = "1" ] + if [ "${SKIP_TEST_ENV_CREATION}" = "true" ] then circleci step halt fi @@ -351,35 +356,31 @@ jobs: type: string terraform-config-dir: type: string - aws-access-key-id: - type: env_var_name - default: AWS_ACCESS_KEY_ID - aws-secret-access-key: - type: env_var_name - default: AWS_SECRET_ACCESS_KEY profile_name: type: string default: 'default' role_arn: type: string default: '' + skip-teardown-env: + type: boolean + default: false docker: - image: << parameters.terraform-image >> steps: - run: name: Check if test env should be destroyed + environment: + SKIP_TEST_ENV_TEARDOWN: <> command: | - if [ "${SKIP_TEST_ENV_TEARDOWN}" = "1" ] + if [ "${SKIP_TEST_ENV_TEARDOWN}" = "true" ] then circleci step halt fi - checkout - - when: - condition: << parameters.role_arn >> - steps: - - aws-cli/setup: - profile_name: << parameters.profile_name >> - role_arn: << parameters.role_arn >> + - aws-cli/setup: + profile_name: << parameters.profile_name >> + role_arn: << parameters.role_arn >> - run: name: terraform init command: | diff --git a/src/examples/verify_revision_deplopyment.yml b/src/examples/verify_revision_deployment.yml similarity index 100% rename from src/examples/verify_revision_deplopyment.yml rename to src/examples/verify_revision_deployment.yml diff --git a/src/scripts/update_bluegreen_service_via_task_def.sh b/src/scripts/update_bluegreen_service_via_task_def.sh index bf69484e..fb953df9 100644 --- a/src/scripts/update_bluegreen_service_via_task_def.sh +++ b/src/scripts/update_bluegreen_service_via_task_def.sh @@ -8,6 +8,7 @@ ORB_STR_CD_LOAD_BALANCED_CONTAINER_NAME="$(circleci env subst "$ORB_STR_CD_LOAD_ ORB_STR_CD_CAPACITY_PROVIDER_WEIGHT="$(circleci env subst "$ORB_STR_CD_CAPACITY_PROVIDER_WEIGHT")" ORB_STR_CD_CAPACITY_PROVIDER_BASE="$(circleci env subst "$ORB_STR_CD_CAPACITY_PROVIDER_BASE")" ORB_STR_CD_DEPLOYMENT_CONFIG_NAME="$(circleci env subst "$ORB_STR_CD_DEPLOYMENT_CONFIG_NAME")" +ORB_STR_PROFILE_NAME="$(circleci env subst "$ORB_STR_PROFILE_NAME")" DEPLOYED_REVISION="${CCI_ORB_AWS_ECS_REGISTERED_TASK_DFN}" @@ -34,6 +35,7 @@ fi DEPLOYMENT_ID=$(aws deploy create-deployment \ --application-name "$ORB_STR_CD_APP_NAME" \ --deployment-group-name "$ORB_STR_CD_DEPLOY_GROUP_NAME" \ + --profile "$ORB_STR_PROFILE_NAME" \ --query deploymentId \ --revision "${REVISION}" \ "$@" \ @@ -43,11 +45,11 @@ echo "Created CodeDeploy deployment: $DEPLOYMENT_ID" if [ "$ORB_BOOL_VERIFY_REV_DEPLOY" == "1" ]; then echo "Waiting for deployment to succeed." - if aws deploy wait deployment-successful --deployment-id "${DEPLOYMENT_ID}"; then + if aws deploy wait deployment-successful --deployment-id "${DEPLOYMENT_ID}" --profile "${ORB_STR_PROFILE_NAME}"; then echo "Deployment succeeded." elif [ "$ORB_BOOL_ENABLE_CIRCUIT_BREAKER" == "1" ]; then echo "Deployment failed. Rolling back." - aws deploy stop-deployment --deployment-id "${DEPLOYMENT_ID}" --auto-rollback-enabled + aws deploy stop-deployment --deployment-id "${DEPLOYMENT_ID}" --auto-rollback-enabled --profile "${ORB_STR_PROFILE_NAME}" else echo "Deployment failed. Exiting." exit 1