Skip to content

Fix: CFn repeated deployments breaking #11632

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

Merged
merged 4 commits into from
Oct 3, 2024
Merged

Conversation

simonrw
Copy link
Contributor

@simonrw simonrw commented Oct 3, 2024

Motivation

As reported in #11333, performing a deployment of a previously deleted stack fails with the error message:

InvalidChangeSetStatus: ChangeSet [arn:aws:cloudformation:us-east-1:000000000000:changeSet/cdk-deploy-change-set/87846077] cannot be executed in its current status of [CREATE_COMPLETE]

This is because we don't filter out deleted changesets when looking for a changeset, and therefore assume the changeset already exists and incorrectly fail. Also this only happens when specifying changeset names, which CDK does.

This PR superscedes #11384, however @migraf wrote the initial implementation.

Closes #11333

Changes

  • Fetch only active changesets
  • Add validated test that performs the deploy/delete/deploy process

migraf and others added 2 commits October 3, 2024 16:36
filter by active stack when executing a changeset

use existing store functions to find the changeset

check for none

revert to loop based filtering
@simonrw simonrw added aws:cloudformation AWS CloudFormation semver: patch Non-breaking changes which can be included in patch releases labels Oct 3, 2024
@simonrw simonrw self-assigned this Oct 3, 2024
Copy link

github-actions bot commented Oct 3, 2024

LocalStack Community integration with Pro

  2 files  ±    0    2 suites  ±0   19m 19s ⏱️ - 1h 21m 46s
409 tests  - 3 071  293 ✅  - 2 773  116 💤  - 298  0 ❌ ±0 
411 runs   - 3 071  293 ✅  - 2 773  118 💤  - 298  0 ❌ ±0 

Results for commit 7322e95. ± Comparison against base commit 5d2c090.

This pull request removes 3072 and adds 1 tests. Note that renamed tests count towards both.
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_lambda_dynamodb
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_opensearch_crud
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_search_books
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_setup
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_destination_sns
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_infra
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_prefill_dynamodb_table
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input0-SUCCEEDED]
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input1-SUCCEEDED]
…
tests.aws.services.cloudformation.api.test_changesets ‑ test_create_delete_create

♻️ This comment has been updated with latest results.

@simonrw simonrw marked this pull request as ready for review October 3, 2024 16:06
Copy link
Member

@dominikschubert dominikschubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nits, otherwise LGTM!

) -> Optional[StackChangeSet]:
store = get_cloudformation_store(account_id, region_name)
for stack in store.stacks.values():
if active_only and stack.status == "DELETE_COMPLETE":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could also reference the value from the generated API here

@pinzon pinzon merged commit 50b4063 into master Oct 3, 2024
35 checks passed
@pinzon pinzon deleted the fix/cfn/multiple-deployments branch October 3, 2024 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws:cloudformation AWS CloudFormation semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: repeated CDK deploy fails with InvalidChangeSetStatus
4 participants