-
Notifications
You must be signed in to change notification settings - Fork 4k
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): hotswap should not disable rollback #17267
Comments
Hey @tmokmss, thanks so much for opening the issue! A few comments. First of all, I don't think you need to add the Second, I assume the only problem with disabling rollback is resource replacement, right? In that case, Finally, we actually have another feature in the works, called "cdk watch" (here's the PR: #17240). With it, the idea is that you would invoke @eladb do you want to chime in here? Thanks, |
Hi @skinny85
Yes, that's exactly what I thought! I'm too lazy to decide which option to use on each deploy. What I don't understand yet is that is there any reason to disable rollback by default when we use hotswap. Isn't it simpler to enable them by separate flags? Thanks. |
Also |
|
And it is also the default for the new |
@tmokmss one clarifying question. Does a CloudFormation deployment with rollback disabled always fail when there's a replacement? Or does it fail only if the replacement failed (for example, that could happen if you used a physical name of the resource, so creating the replacement one fails)? |
@skinny85 I confirmed to reproduce by the following steps (I know hotswap does nothing on this kind of stack, but just for an example):
import * as cdk from "@aws-cdk/core";
import * as dynamodb from "@aws-cdk/aws-dynamodb";
export class TestStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
new dynamodb.Table(this, "Table", {
partitionKey: { name: "id", type: dynamodb.AttributeType.STRING },
});
}
}
I guess CFn doesn't allow this because otherwise a deployment failure without rollback may result in a complex situation such that two physical resources (old and new) are associated with the same logical id. |
Yes, I think you are correct that this is the motivation. I also tend to agree that this is a strong case for not disabling rollbacks for hotswaps by default and requiring an explicit opt-in switch to disable them. I think it will also be valuable to add some documentation about the fact if the deployment includes resource replacement, rollbacks cannot be disabled. |
Previously, we would default the --rollback flag to `false` if it wasn't provided if the `--hotswap` option was also passed to `cdk deploy`. However, disabled rollback does not play well with deployments that cause replacements - they fail, and leave the Stack in a weird state. For that reason, stop disabling rollback by default. It's still possible to disable easily if wanted by using the `-R` switch. Fixes aws#17267
…ts (#17317) Previously, we would default the `--rollback` flag to `false` if it wasn't explicitly provided if the `--hotswap` option was also passed to `cdk deploy`. However, disable rollback does not play well with deployments that cause replacements - they fail, and leave the Stack in a weird state. For that reason, stop disabling rollback by default. It's still possible to disable rollback easily if a customer wants to by using the `-R` switch. Fixes #17267 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
…ts (aws#17317) Previously, we would default the `--rollback` flag to `false` if it wasn't explicitly provided if the `--hotswap` option was also passed to `cdk deploy`. However, disable rollback does not play well with deployments that cause replacements - they fail, and leave the Stack in a weird state. For that reason, stop disabling rollback by default. It's still possible to disable rollback easily if a customer wants to by using the `-R` switch. Fixes aws#17267 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
What is the problem?
Hi team!
Currently when we enable hotswap, it also disables rollback implicitly, which is not desirable at least for me. Here is why:
cdk deploy --hotswap --rollback true
. Then why does the hotswap flag currently have unnecessary and confusing side effect? If we need hotswap and no-rollback, we can just typecdk deploy --hotswap -R
, which is shorter and more explicit.When I develop CDK apps, I always deploy with hotswap. Hotswap is great in that it automatically switch to a normal CFn deploy when there are changes that cannot be hotswapped, thus happy to use it almost brainlessly. However, I must also add
--rollback true
because otherwise deploy fails if there's any replacement change. Unlike hotswap, it won't switch when it cannot be used. It'd be great if we can just use--hotswap
flag simply without worring about rollback. Actually I sometimes forget to add rollback flag, resulting in a failed deployment.I'd like to hear your opinion about this, thanks!
Reproduction Steps
run deploy with hotswap enabled
What did you expect to happen?
Rollback is enabled as per default since I don't specify any flags related to it.
What actually happened?
Rollback is disabled. Actually if we need hotswap with rollback, we should have used the command below instead:
CDK CLI Version
1.129.0
Framework Version
1.129.0
Node.js Version
v14.15.0
OS
macOS
Language
Typescript
Language Version
3.9.7
Other information
No response
The text was updated successfully, but these errors were encountered: