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(cli): hotswap support for resources in nested stacks #18950

Merged
merged 41 commits into from
Feb 25, 2022

Conversation

comcalvi
Copy link
Contributor

Resources in nested stacks can now be hotswapped.


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

@comcalvi comcalvi requested a review from skinny85 February 12, 2022 01:10
@gitpod-io
Copy link

gitpod-io bot commented Feb 12, 2022

@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Feb 12, 2022
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Feb 12, 2022
@comcalvi comcalvi assigned skinny85 and unassigned rix0rrr Feb 12, 2022
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

I just skimmed for now (this is quite complex), but one thing stuck out to me.

@comcalvi comcalvi requested a review from skinny85 February 14, 2022 16:23
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @comcalvi! This is a good first attempt, but there are some functional problems with the current code, and some design and organizational ones, before we can merge this in.

@comcalvi comcalvi force-pushed the hotswap-nested-stacks branch from d8d5cd1 to 8034f84 Compare February 24, 2022 00:25
@comcalvi comcalvi requested a review from skinny85 February 24, 2022 00:26
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

Looks great @comcalvi! I don't have any comments on the functionality, I only have some comments on the code details.

The most important thing I want to see before we merge this in is getting rid of the multiple calls to diff the Stacks. Ideally, we should perform a single diff, that includes the Nested Stacks, and use that for hotswapping. The same way we don't call diff multiple times for the cdk diff command for Nested Stacks.

@comcalvi comcalvi requested a review from skinny85 February 25, 2022 18:28
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

Looks almost perfect! One last iteration, and we'll get this merged in.

@@ -60,16 +96,22 @@ export function stackSummaryOf(logicalId: string, resourceType: string, physical
export class HotswapMockSdkProvider {
public readonly mockSdkProvider: MockSdkProvider;

constructor() {
constructor(rootStackName?: string, childStacks?: string[]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about

Suggested change
constructor(rootStackName?: string, childStacks?: string[]) {
constructor(rootStackName?: string, childStacks: string[] = []) {

? Will save you the null checks on childStacks below.

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 think we don't actually need childStacks at all, I've reworked this to be better.

@@ -454,7 +454,7 @@ test("will not perform a hotswap deployment if it doesn't know how to handle a s
template: {
Resources: {
Bucket: {
Type: 'AWS::Lambda::Function',
Type: 'AWS::S3::Bucket',
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch 😉

@comcalvi comcalvi requested a review from skinny85 February 25, 2022 21:10
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

Looks great @comcalvi!

@mergify
Copy link
Contributor

mergify bot commented Feb 25, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: d70f600
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify mergify bot merged commit 2ea9da1 into aws:master Feb 25, 2022
@mergify
Copy link
Contributor

mergify bot commented Feb 25, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants