feat(cli): add message when resource is hotswapped#18058
feat(cli): add message when resource is hotswapped#18058mergify[bot] merged 5 commits intoaws:masterfrom corymhall:corymhall/hotswap-complete
Conversation
Add additional messages to indicate that a hotswap deployment is occurring (or not) along with what resources are being hotswapped. fix #17778
skinny85
left a comment
There was a problem hiding this comment.
Looks good @corymhall! A few comments on the first pass 🙂.
| // if we can skip deployment and we are performing a hotswap, let the user know | ||
| // that no hotswap deployment happened | ||
| if (options.hotswap) { | ||
| print(`\n ${ICON} %s\n`, colors.bold('no hotswap deployment')); |
There was a problem hiding this comment.
I feel like this message needs a little polish... We have to make sure it's clear that the deployment isn't happening, because no changes were detected.
Something like:
| print(`\n ${ICON} %s\n`, colors.bold('no hotswap deployment')); | |
| print(`\n ${ICON} %s\n`, colors.bold('deployment skipped - no changes were detected (use --force to override)')); |
packages/aws-cdk/lib/api/hotswap/stepfunctions-state-machines.ts
Outdated
Show resolved
Hide resolved
| public async apply(sdk: ISDK): Promise<any> { | ||
| // not passing the optional properties leaves them unchanged | ||
| const name = this.stepFunctionResource.stateMachineArn.split(':')[6]; | ||
| print(` ${ICON} hotswapping state machine: %s`, colors.bold(name)); |
There was a problem hiding this comment.
I don't love the fact that we're putting these print statements inside of the hotswap operations themselves.
How about we change the return type of the apply() method in HotswapOperation to return the identifier of the hotswapped resource (or maybe even resources), and then the print() logic will only be inside hotswap-deployments.ts?
I feel like that's a nicer separation of concerns than having the print() statements here.
There was a problem hiding this comment.
Moved these back to hotswap-deployments as we discussed.
skinny85
left a comment
There was a problem hiding this comment.
Looks great! Minor comments on the style, but otherwise looks awesome!
packages/aws-cdk/lib/api/hotswap/stepfunctions-state-machines.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Adam Ruka <adamruka85@gmail.com>
skinny85
left a comment
There was a problem hiding this comment.
Looks great, thanks @corymhall!
|
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). |
|
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 CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Looks good. For next time, when doing UI changes, I would recommend sharing a screenshot or screencast of how this looks in the PR description or comment. |
|
To be fair, Cory did actually share a gif of the experience with us, it was just in our private Slack 🙂. |
|
Sharing is caring |
This extends the existing hotswapping support for Lambda Functions to also work for Versions and Aliases. Implementation-wise, this required quite a bit of changes, as Versions are immutable in CloudFormation, and the only way you can change them is by replacing them; so, we had to add the notion of replacement changes to our hotswapping logic (as, up to this point, they were simply a pair of "delete" and "add" changes, which would result in hotswapping determining it can't proceed, and falling back to a full CloudFormation deployment). I also modified the main hotswapping algorithm: now, a resource change is considered non-hotswappable if all detectors return `REQUIRES_FULL_DEPLOYMENT` for it; if at least one detector returns `IRRELEVANT`, we ignore this change. This allows us to get rid of the awkward `EmptyHotswapOperation` that we had to use before in these situations. I also made a few small tweaks to the printing messages added in #18058: I no longer prefix them with the name of the service, as now hotswapping can affect different resource types, and it looked a bit awkward with that prefix present. Fixes #17043 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Add additional messages to indicate that a hotswap deployment is occurring (or not) along with what resources are being hotswapped. fix aws#17778 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
…8145) This extends the existing hotswapping support for Lambda Functions to also work for Versions and Aliases. Implementation-wise, this required quite a bit of changes, as Versions are immutable in CloudFormation, and the only way you can change them is by replacing them; so, we had to add the notion of replacement changes to our hotswapping logic (as, up to this point, they were simply a pair of "delete" and "add" changes, which would result in hotswapping determining it can't proceed, and falling back to a full CloudFormation deployment). I also modified the main hotswapping algorithm: now, a resource change is considered non-hotswappable if all detectors return `REQUIRES_FULL_DEPLOYMENT` for it; if at least one detector returns `IRRELEVANT`, we ignore this change. This allows us to get rid of the awkward `EmptyHotswapOperation` that we had to use before in these situations. I also made a few small tweaks to the printing messages added in aws#18058: I no longer prefix them with the name of the service, as now hotswapping can affect different resource types, and it looked a bit awkward with that prefix present. Fixes aws#17043 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Add additional messages to indicate that a hotswap deployment is
occurring (or not) along with what resources are being hotswapped.
fix #17778
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license