Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(codedeploy) - Added ECS CodeDeploy support #22081

Closed
wants to merge 2 commits into from

Conversation

cplee
Copy link
Contributor

@cplee cplee commented Sep 16, 2022

CloudFormation now supports creating AWS::CodeDeploy::DeploymentGroup for ECS services. There is an existing L2 construct that only supported imports. This PR allows the creation of EcsDeploymentGroup and EcsDeploymentConfig


All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Sep 16, 2022

…eployment configurations and deployment groups for ECS
Copy link
Member

@clareliguori clareliguori left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha I literally just finished up writing a similar construct! Great minds, etc
main...clareliguori:aws-cdk:in-progress-codedeploy-ecs

I've left a few comments where I saw differences between our implementations

*
* @default a name will be auto-generated
*/
readonly trafficRoutingConfig?: ITrafficRoutingConfig;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a related open PR that creates LambdaDeploymentConfig class, and we should make sure the Props structures are consistent. I chose to copy over the structure that LambdaDeploymentConfig has, where percentage, interval, etc are in the root Props structure:
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codedeploy.CustomLambdaDeploymentConfig.html

I'm not super opinionated either way if you feel like this is a better structure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I preferred the pattern in the ServerDeploymentConfig. I worry about the pattern in LambdaDeploymentConfig assumes any potential future types would have a similar shape (type + percentage + interval). Seems if a future deployment config type didn't look like that, then it would be hard to extend the current implementation.

I may be overthinking though 🤷‍♂️

Comment on lines +231 to +233
// Remove revision from ECS Service task definition to allow Blue/Green deploys to work
cfnService.taskDefinition = service.taskDefinition.family;
service.node.addDependency(service.taskDefinition);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain more? I'm not following why this is necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how I avoid CloudFormation trying to update the ECS service when the TaskDefinition revision changes. By removing revision and only using family, it is only deployed on creation and ignored going forward.

*
* @default - blank if empty on test traffic route. Required for prod traffic route.
*/
readonly listener: elbv2.IApplicationListener | elbv2.INetworkListener | undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up creating a new IListener interface to avoid using a union type here:
clareliguori@c5eb191#diff-1ce9801f6492a5d0a765325bd3737f3622605d4c7a6910547e075ce01ca06fcb

@cplee
Copy link
Contributor Author

cplee commented Sep 17, 2022

Thanks @clareliguori for the feedback. I pushed a bunch of changes to address your comments. When your PR is ready, please drop a link in here and I can close this PR in favor of yours.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 468cb07
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@cplee
Copy link
Contributor Author

cplee commented Sep 29, 2022

Closing this in favor of #22295

@cplee cplee closed this Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants