Skip to content

feat(cli): hotswap support for resources in nested stacks#18950

Merged
mergify[bot] merged 41 commits intoaws:masterfrom
comcalvi:hotswap-nested-stacks
Feb 25, 2022
Merged

feat(cli): hotswap support for resources in nested stacks#18950
mergify[bot] merged 41 commits intoaws:masterfrom
comcalvi:hotswap-nested-stacks

Conversation

@comcalvi
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

public readonly mockSdkProvider: MockSdkProvider;

constructor() {
constructor(rootStackName?: string, childStacks?: string[]) {
Copy link
Copy Markdown
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
Copy Markdown
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.

Resources: {
Bucket: {
Type: 'AWS::Lambda::Function',
Type: 'AWS::S3::Bucket',
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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