Skip to content

Commit

Permalink
Merge pull request #180 from CircleCI-Public/implement-deployment-con…
Browse files Browse the repository at this point in the history
…fig-name

feat: implement deployment-config-name parameter
  • Loading branch information
brivu committed Aug 12, 2022
2 parents ea4e43d + fcd2642 commit e4391f5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/commands/update-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ parameters:
Must be used with codedeploy-capacity-provider-name and codedeploy-capacity-provider-base.
type: string
default: ''
deployment-config-name:
description: >
The name of a CODE DEPLOY deployment configuration associated with the IAM user or AWS account.
If not specified, the value configured in the deployment group is used as the default.
type: string
default: ''

steps:
- unless:
Expand Down Expand Up @@ -210,6 +216,7 @@ steps:
ECS_PARAM_CD_CAPACITY_PROVIDER_NAME: <<parameters.codedeploy-capacity-provider-name>>
ECS_PARAM_CD_CAPACITY_PROVIDER_WEIGHT: <<parameters.codedeploy-capacity-provider-weight>>
ECS_PARAM_CD_CAPACITY_PROVIDER_BASE: <<parameters.codedeploy-capacity-provider-base>>
ECS_PARAM_CD_DEPLOYMENT_CONFIG_NAME: <<parameters.deployment-config-name>>

- when:
condition:
Expand Down
8 changes: 8 additions & 0 deletions src/jobs/deploy-service-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ parameters:
Must be used with codedeploy-capacity-provider-name and capacity-provider-base.
type: string
default: ''
deployment-config-name:
description: >
The name of a CODE DEPLOY deployment configuration associated with the IAM user or AWS account.
If not specified, the value configured in the deployment group is used as the default.
type: string
default: ''

steps:
- aws-cli/setup:
aws-access-key-id: << parameters.aws-access-key-id >>
Expand Down Expand Up @@ -233,3 +240,4 @@ steps:
codedeploy-capacity-provider-name: <<parameters.codedeploy-capacity-provider-name>>
codedeploy-capacity-provider-weight: <<parameters.codedeploy-capacity-provider-weight>>
codedeploy-capacity-provider-base: <<parameters.codedeploy-capacity-provider-base>>
deployment-config-name: <<parameters.deployment-config-name>>
7 changes: 7 additions & 0 deletions src/scripts/update-bluegreen-service-via-task-def.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -o noglob
ECS_PARAM_CD_APP_NAME=$(eval echo "$ECS_PARAM_CD_APP_NAME")
ECS_PARAM_CD_DEPLOY_GROUP_NAME=$(eval echo "$ECS_PARAM_CD_DEPLOY_GROUP_NAME")
ECS_PARAM_CD_LOAD_BALANCED_CONTAINER_NAME=$(eval echo "$ECS_PARAM_CD_LOAD_BALANCED_CONTAINER_NAME")
ECS_PARAM_CD_DEPLOYMENT_CONFIG_NAME=$(eval echo "$ECS_PARAM_CD_DEPLOYMENT_CONFIG_NAME")

DEPLOYED_REVISION="${CCI_ORB_AWS_ECS_REGISTERED_TASK_DFN}"

Expand All @@ -23,12 +24,18 @@ else
REVISION="{\"revisionType\": \"AppSpecContent\", \"appSpecContent\": {\"content\": \"{\\\"version\\\": 1, \\\"Resources\\\": [{\\\"TargetService\\\": {\\\"Type\\\": \\\"AWS::ECS::Service\\\", \\\"Properties\\\": {\\\"TaskDefinition\\\": \\\"${CCI_ORB_AWS_ECS_REGISTERED_TASK_DFN}\\\", \\\"LoadBalancerInfo\\\": {\\\"ContainerName\\\": \\\"$ECS_PARAM_CD_LOAD_BALANCED_CONTAINER_NAME\\\", \\\"ContainerPort\\\": $ECS_PARAM_CD_LOAD_BALANCED_CONTAINER_PORT}}}}]}\"}}"
fi

if [ -n "$ECS_PARAM_CD_DEPLOYMENT_CONFIG_NAME" ]; then
set -- "$@" --deployment-config-name "${ECS_PARAM_CD_DEPLOYMENT_CONFIG_NAME}"
fi

DEPLOYMENT_ID=$(aws deploy create-deployment \
--application-name "$ECS_PARAM_CD_APP_NAME" \
--deployment-group-name "$ECS_PARAM_CD_DEPLOY_GROUP_NAME" \
--query deploymentId \
--revision "${REVISION}" \
"$@" \
--output text)

echo "Created CodeDeploy deployment: $DEPLOYMENT_ID"

if [ "$ECS_PARAM_VERIFY_REV_DEPLOY" == "1" ]; then
Expand Down

0 comments on commit e4391f5

Please sign in to comment.