From 30e994780440ca0c66a51afdb97e1d3a26824284 Mon Sep 17 00:00:00 2001 From: Brian Vu Date: Fri, 12 Aug 2022 09:20:31 -0700 Subject: [PATCH 1/2] feat: added deployment-config-name parameter to deploy-service job --- src/jobs/deploy-service-update.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/jobs/deploy-service-update.yml b/src/jobs/deploy-service-update.yml index 5f410394..da8a2c9a 100644 --- a/src/jobs/deploy-service-update.yml +++ b/src/jobs/deploy-service-update.yml @@ -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 >> @@ -233,3 +240,4 @@ steps: codedeploy-capacity-provider-name: <> codedeploy-capacity-provider-weight: <> codedeploy-capacity-provider-base: <> + deployment-config-name: <> From fcd264218d4362fcc763758786c7f1fb40beb36a Mon Sep 17 00:00:00 2001 From: Brian Vu Date: Fri, 12 Aug 2022 09:33:02 -0700 Subject: [PATCH 2/2] feat: added deployment-config-name parameter to update-service command --- src/commands/update-service.yml | 7 +++++++ src/scripts/update-bluegreen-service-via-task-def.sh | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/commands/update-service.yml b/src/commands/update-service.yml index d5c09cb4..d25f6ded 100644 --- a/src/commands/update-service.yml +++ b/src/commands/update-service.yml @@ -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: @@ -210,6 +216,7 @@ steps: ECS_PARAM_CD_CAPACITY_PROVIDER_NAME: <> ECS_PARAM_CD_CAPACITY_PROVIDER_WEIGHT: <> ECS_PARAM_CD_CAPACITY_PROVIDER_BASE: <> + ECS_PARAM_CD_DEPLOYMENT_CONFIG_NAME: <> - when: condition: diff --git a/src/scripts/update-bluegreen-service-via-task-def.sh b/src/scripts/update-bluegreen-service-via-task-def.sh index d356ddcc..5d657ca6 100644 --- a/src/scripts/update-bluegreen-service-via-task-def.sh +++ b/src/scripts/update-bluegreen-service-via-task-def.sh @@ -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}" @@ -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