Skip to content

feat(cli): add --concurrency flag to cdk destroy#1221

Merged
mrgrain merged 2 commits intoaws:mainfrom
mikevoets:feat/destroy-concurrency
Mar 13, 2026
Merged

feat(cli): add --concurrency flag to cdk destroy#1221
mrgrain merged 2 commits intoaws:mainfrom
mikevoets:feat/destroy-concurrency

Conversation

@mikevoets
Copy link
Contributor

@mikevoets mikevoets commented Mar 13, 2026

Fixes #752

Description

Add --concurrency flag to cdk destroy, mirroring the existing cdk deploy --concurrency behavior. When set to a value greater than 1, multiple stacks are destroyed in parallel while respecting dependency order (reversed from deploy).

Uses WorkGraph with reversed dependency edges to orchestrate parallel destruction. A new WorkGraph.processStacks() method provides a stack-only execution path, and the graph construction logic lives in its own build-destroy-work-graph module.

Checklist

  • This change contains a major version upgrade for a dependency and I confirm all breaking changes are addressed
    • Release notes for the new version:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the p2 label Mar 13, 2026
@aws-cdk-automation aws-cdk-automation requested a review from a team March 13, 2026 06:22
@github-actions github-actions bot added effort/medium 1-3 days of effort feature-request p1 and removed p2 labels Mar 13, 2026
@mikevoets mikevoets marked this pull request as ready for review March 13, 2026 08:08
Copy link
Contributor

@mrgrain mrgrain left a comment

Choose a reason for hiding this comment

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

Nice one!

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 91.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.05%. Comparing base (cf3cd7d) to head (25be8f0).

Files with missing lines Patch % Lines
packages/aws-cdk/lib/cli/cdk-toolkit.ts 95.45% 1 Missing ⚠️
packages/aws-cdk/lib/cli/cli.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1221      +/-   ##
==========================================
+ Coverage   87.79%   88.05%   +0.25%     
==========================================
  Files          73       73              
  Lines       10168    10187      +19     
  Branches     1343     1351       +8     
==========================================
+ Hits         8927     8970      +43     
+ Misses       1217     1193      -24     
  Partials       24       24              
Flag Coverage Δ
suite.unit 88.05% <91.66%> (+0.25%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mrgrain mrgrain added this pull request to the merge queue Mar 13, 2026
Merged via the queue into aws:main with commit 403fe8e Mar 13, 2026
41 checks passed
@mikevoets mikevoets deleted the feat/destroy-concurrency branch March 13, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cli: cdk destroy with concurrency

3 participants