fix(CLI): cdk diff stack deletion causes a race condition#29492
fix(CLI): cdk diff stack deletion causes a race condition#29492mergify[bot] merged 16 commits intomainfrom
cdk diff stack deletion causes a race condition#29492Conversation
aws-cdk-automation
left a comment
There was a problem hiding this comment.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.
TheRealAmazonKendra
left a comment
There was a problem hiding this comment.
Correct me if I'm wrong here, but since we reverted #29485, if this is a cdk migrate based stack, we will now always tell customers that we are creating new resources instead of importing them. The original change was to prevent this very thing.
|
I think the correct fix here is mostly what @scanlonp did in #29394. The one piece that would have prevented the role switch here was if in The change had been: Because the if statement will exit if |
scanlonp
left a comment
There was a problem hiding this comment.
Looks good to me.
Only comments would be:
- is there a functional difference in doing a try catch block in
cleanupOldChangeset()as opposed to checking the exists parameter, or is this just for code clarity? - If we have a migrate stack, it will not exist beforehand, so the logic could be streamlined. But it is not blocking and I am good with how it is.
turns out that
I think I've altered the logic you're referring to, it should be more clear now. |
scanlonp
left a comment
There was a problem hiding this comment.
Good to approve from me! I'll wait for Kendra to take a look.
Minor nit on the debug message.
…hub.com:aws/aws-cdk into comcalvi/changeset-diff-wait-for-stack-deletion
comcalvi
left a comment
There was a problem hiding this comment.
test pipeline deployment is complaining there's no review...
|
➡️ PR build request submitted to A maintainer must now check the pipeline and add the |
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
|
Thank you for contributing! Your pull request will be updated from main 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 |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
*Co-authored by*: @scanlonp ### Issue # (if applicable) Closes aws#29265. ### Reason for this change Creating a changeset for a stack that has not been deployed yet causes CFN to create a stack in state `REVIEW_IN_PROGRESS`. Previously we deleted this empty stack, but did not wait for the stack status to be `DELETE_COMPLETE`. This allowed `cdk diff` to exit while the stack status was still `DELETE_IN_PROGRESS`, which can cause subsequent CDK commands to fail, because a stack deletion operation is still in progress. ### Description of changes No longer create the changeset if the stack doesn't exist. Only perform the existence check if the changeset parameter is specified, to avoid a permission error when looking up a stack. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Co-authored by: @scanlonp
Issue # (if applicable)
Closes #29265.
Reason for this change
Creating a changeset for a stack that has not been deployed yet causes CFN to create a stack in state
REVIEW_IN_PROGRESS. Previously we deleted this empty stack, but did not wait for the stack status to beDELETE_COMPLETE. This allowedcdk diffto exit while the stack status was stillDELETE_IN_PROGRESS, which can cause subsequent CDK commands to fail, because a stack deletion operation is still in progress.Description of changes
No longer create the changeset if the stack doesn't exist. Only perform the existence check if the changeset parameter is specified, to avoid a permission error when looking up a stack.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license