Skip to content

Commit

Permalink
fix: minor PR issues (#202)
Browse files Browse the repository at this point in the history
* chore: correct filename typo

* fix: add profile to code deploy green blue deployments

* fix: change conditional from 1 to true
  • Loading branch information
brivu authored Jul 28, 2023
1 parent 64e67ad commit 6814b79
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
29 changes: 15 additions & 14 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: <<parameters.skip-creation-env>>
command: |
if [ "${SKIP_TEST_ENV_CREATION}" = "1" ]
if [ "${SKIP_TEST_ENV_CREATION}" = "true" ]
then
circleci step halt
fi
Expand Down Expand Up @@ -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: <<parameters.skip-teardown-env>>
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: |
Expand Down
File renamed without changes.
6 changes: 4 additions & 2 deletions src/scripts/update_bluegreen_service_via_task_def.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand All @@ -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}" \
"$@" \
Expand All @@ -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
Expand Down

0 comments on commit 6814b79

Please sign in to comment.