-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
cli: allow users to force-hotswap when they want to #21773
Comments
@huyphan thanks for opening this feature request. I see the use case for this, and would be happy to implement it. I'm thinking this will take a new form, There are two levels of "ignoring" we can do. The first is to only ignore changes to non-hotswappable resources. This covers the use case you described (eg, a lambda function is updated, which in turn causes a metric to update). We could go one step further, and allow hotswap to ignore changes to properties on a hotswappable resource itself. For example, this would allow you to change a Lambda Function's name and code and allow a hotswap deployment to proceed. This deployment would not change the function name, only its code. The function name won't be updated until a full deployment is performed. Are you asking for the first level I described only, or the second? |
Hey @comcalvi , I think the first level would work for me and would be more intuitive for general users. |
…fall back if necessary (#23653) Changes the behavior of `--hotswap` to ignore all non-hotswappable changes and hotswap what it can. This works at two levels: changes to non-hotswappable resources are ignored, as well as non-hotswappable changes to hotswappable resources (eg `Tags` on a Lambda Function). In addition, non-hotswappable changes are now logged; the logical ID, rejected changes, resource type, and reason why the changes were rejected are all provided for each non-hotswappable change. At some point, support for tags of lambda functions was added. This either broke or simply never worked, and so this PR removes all logic to handle Tags. The existing behavior of `--hotswap` can be used in `--hotswap-fallback`. It is preserved and unmodified by this change. Closes #22784, #21773, #21556, #23640. ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Construct Runtime Dependencies: * [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] 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*
fixed by #23653 |
|
Describe the feature
This proposal can be controversial as it changes the mental model of hotswap. So please bear with me. The main idea is to allow users to force a hotswap deployment even when there are non-hotswappable changes.
Use Case
The idea today is that, hotswap only works if the stack's changeset contains only hotswappable changes, otherwise a full deployment will be performed. This makes sense. But then the question is, what should users do when they have a non-hotswappable change in their changeset?
First, let's talk about what those non-hotswappable changes are. There are three categories:
Fn:Import
intrincsic function.For the last two categories, users have a few options to enable hotswap back:
if ... else ...
) that permanently removes the resources only when deploying to development/non-production stack. This approach removes the ability to test the production changes in development stack.So, the fourth option is the most feasible option there. Unfortunately, that's not a sustainable option for the CDK team given the number of potential non-hotswappable changes. It's almost a never-ending chase. Users usually have no idea when they can be unblocked.
Proposal
The reason why we ended up with today's situation is because we think if there's a change in the template, they must be deployed, even when hotswapping. That's not always necessary. If I'm testing my Lambda code, I only need the version and alias to be updated. Everything else is optional.
When we see a non-hotswappable changes, users should be able to say "it is okay to skip those changes for now, I just want my code to be up and run"; then CDK will just hotswap all the things it can and leave the rest behind.
Potential implementation
Example of how it would work when user runs
cdk deploy --hotswap <stack-name>
and there are unsupported changes:(I stole the idea of prompting users from @CaerusKaru, so the credit goes to him.)
The concerns
This feature potentially causes more drifts in user's stacks; and this is mostly a concern for a production stack. But this is an existing risk of hotswap. In the RFC 0001-cdk-update , we stated that
So the goal is not about making hotswap safe, but rather controlling the destination where hotswap is allowed.
Proposed Solution
No response
Other Information
No response
Acknowledgements
CDK version used
N/A
Environment details (OS name and version, etc.)
N/A
The text was updated successfully, but these errors were encountered: