diff --git a/src/commands/update-service.yml b/src/commands/update-service.yml index 481a487e..68fbb5d3 100644 --- a/src/commands/update-service.yml +++ b/src/commands/update-service.yml @@ -32,6 +32,12 @@ parameters: Only effective when the deployment-controller parameter value is "CODE_DEPLOY". type: string default: '' + codedeploy-deployment-config-name: + description: > + The name of the group's deployment config. + Only effective when the deployment-controller parameter value is "CODE_DEPLOY". + type: string + default: '' codedeploy-load-balanced-container-name: description: > The name of the container to be load-balanced via AWS CodeDeploy. @@ -169,6 +175,7 @@ steps: DEPLOYMENT_CONTROLLER: <<parameters.deployment-controller>> ECS_PARAM_CD_APP_NAME: <<parameters.codedeploy-application-name>> ECS_PARAM_CD_DEPLOY_GROUP_NAME: <<parameters.codedeploy-deployment-group-name>> + ECS_PARAM_CD_DEPLOY_CONFIG_NAME: <<parameters.codedeploy-deployment-config-name>> ECS_PARAM_CD_LOAD_BALANCED_CONTAINER_NAME: <<parameters.codedeploy-load-balanced-container-name>> ECS_PARAM_CD_LOAD_BALANCED_CONTAINER_PORT: <<parameters.codedeploy-load-balanced-container-port>> ECS_PARAM_VERIFY_REV_DEPLOY: <<parameters.verify-revision-is-deployed>> diff --git a/src/jobs/deploy-service-update.yml b/src/jobs/deploy-service-update.yml index c4791950..e4f0f361 100644 --- a/src/jobs/deploy-service-update.yml +++ b/src/jobs/deploy-service-update.yml @@ -54,6 +54,12 @@ parameters: "CODE_DEPLOY". type: string default: '' + codedeploy-deployment-config-name: + description: > + The name of the group's deployment config. + Only effective when the deployment-controller parameter value is "CODE_DEPLOY". + type: string + default: '' codedeploy-load-balanced-container-name: description: > The name of the container to be load-balanced via AWS CodeDeploy. @@ -184,6 +190,7 @@ steps: deployment-controller: << parameters.deployment-controller >> codedeploy-application-name: << parameters.codedeploy-application-name >> codedeploy-deployment-group-name: << parameters.codedeploy-deployment-group-name >> + codedeploy-deployment-config-name: << parameters.codedeploy-deployment-config-name >> codedeploy-load-balanced-container-name: << parameters.codedeploy-load-balanced-container-name >> codedeploy-load-balanced-container-port: << parameters.codedeploy-load-balanced-container-port >> container-image-name-updates: << parameters.container-image-name-updates >> diff --git a/src/scripts/update-bluegreen-service-via-task-def.sh b/src/scripts/update-bluegreen-service-via-task-def.sh index 900c664b..5c92b815 100644 --- a/src/scripts/update-bluegreen-service-via-task-def.sh +++ b/src/scripts/update-bluegreen-service-via-task-def.sh @@ -4,13 +4,23 @@ 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_DEPLOY_CONFIG_NAME=$(eval echo "$ECS_PARAM_CD_DEPLOY_CONFIG_NAME") +if [ -z $ECS_PARAM_CD_DEPLOY_CONFIG_NAME ] +then + DEPLOYMENT_CONFIG_NAME_ARG="" +else + DEPLOYMENT_CONFIG_NAME_ARG="--deployment-config-name $ECS_DEPLOYMENT_CONFIG_NAME" +fi + + +DEPLOYED_REVISION=$CCI_ORB_AWS_ECS_REGISTERED_TASK_DFN -DEPLOYED_REVISION="${CCI_ORB_AWS_ECS_REGISTERED_TASK_DFN}" DEPLOYMENT_ID=$(aws deploy create-deployment \ - --application-name "$ECS_PARAM_CD_APP_NAME" \ - --deployment-group-name "$ECS_PARAM_CD_DEPLOY_GROUP_NAME" \ + --application-name $ECS_PARAM_CD_APP_NAME \ + --deployment-group-name $ECS_PARAM_CD_DEPLOY_GROUP_NAME \ + $DEPLOYMENT_CONFIG_NAME_ARG \ --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}}}}]}\"}}" \ --query deploymentId \ --output text) @@ -18,7 +28,7 @@ echo "Created CodeDeploy deployment: $DEPLOYMENT_ID" if [ "$ECS_PARAM_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); then echo "Deployment succeeded." else echo "Deployment failed." @@ -26,4 +36,4 @@ if [ "$ECS_PARAM_VERIFY_REV_DEPLOY" == "1" ]; then fi fi -echo "export CCI_ORB_AWS_ECS_DEPLOYED_REVISION='${DEPLOYED_REVISION}'" >> "$BASH_ENV" \ No newline at end of file +echo "export CCI_ORB_AWS_ECS_DEPLOYED_REVISION='${DEPLOYED_REVISION}'" >> "$BASH_ENV"