You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cli): automatically roll back stacks if necessary (#31920)
If a user is deploying with `--no-rollback`, and the stack contains replacements (or the `--no-rollback` flag is dropped), then a rollback needs to be performed before a regular deployment can happen again.
In this PR, we add a prompt where we ask the user to confirm that they are okay with performing a rollback and then a normal deployment.
The way this works is that `deployStack` detects a disallowed combination (replacement and no-rollback, or being in a stuck state and not being called with no-rollback), and returns a special status code. The driver of the calls, `CdkToolkit`, will see those special return codes, prompt the user, and retry.
Also get rid of a stray `Stack undefined` that gets printed to the console.
Closes#30546, Closes#31685
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy file name to clipboardExpand all lines: packages/aws-cdk/README.md
+11-8
Original file line number
Diff line number
Diff line change
@@ -205,11 +205,14 @@ $ cdk deploy -R
205
205
```
206
206
207
207
If a deployment fails you can update your code and immediately retry the
208
-
deployment from the point of failure. If you would like to explicitly roll back a failed, paused deployment,
209
-
use `cdk rollback`.
208
+
deployment from the point of failure. If you would like to explicitly roll back
209
+
a failed, paused deployment, use `cdk rollback`.
210
210
211
-
NOTE: you cannot use `--no-rollback` for any updates that would cause a resource replacement, only for updates
212
-
and creations of new resources.
211
+
`--no-rollback` deployments cannot contain resource replacements. If the CLI
212
+
detects that a resource is being replaced, it will prompt you to perform
213
+
a regular replacement instead. If the stack rollback is currently paused
214
+
and you are trying to perform an deployment that contains a replacement, you
215
+
will be prompted to roll back first.
213
216
214
217
#### Deploying multiple stacks
215
218
@@ -801,7 +804,7 @@ In practice this means for any resource in the provided template, for example,
801
804
}
802
805
```
803
806
804
-
There must not exist a resource of that type with the same identifier in the desired region. In this example that identfier
807
+
There must not exist a resource of that type with the same identifier in the desired region. In this example that identfier
805
808
would be "amzn-s3-demo-bucket"
806
809
807
810
##### **The provided template is not deployed to CloudFormation in the account/region, and there *is* overlap with existing resources in the account/region**
@@ -900,7 +903,7 @@ CDK Garbage Collection.
900
903
> API of feature might still change. Otherwise the feature is generally production
901
904
> ready and fully supported.
902
905
903
-
`cdk gc` garbage collects unused assets from your bootstrap bucket via the following mechanism:
906
+
`cdk gc` garbage collects unused assets from your bootstrap bucket via the following mechanism:
904
907
905
908
- for each object in the bootstrap S3 Bucket, check to see if it is referenced in any existing CloudFormation templates
906
909
- if not, it is treated as unused and gc will either tag it or delete it, depending on your configuration.
@@ -938,7 +941,7 @@ Found X objects to delete based off of the following criteria:
938
941
Delete this batch (yes/no/delete-all)?
939
942
```
940
943
941
-
Since it's quite possible that the bootstrap bucket has many objects, we work in batches of 1000 objects or 100 images.
944
+
Since it's quite possible that the bootstrap bucket has many objects, we work in batches of 1000 objects or 100 images.
942
945
To skip the prompt either reply with `delete-all`, or use the `--confirm=false` option.
0 commit comments