From b0585f4b944ebbf6bc8fb598e0fa6e9f4337b3fc Mon Sep 17 00:00:00 2001 From: Hurtov Oleksii Date: Mon, 5 Dec 2022 18:23:41 +0200 Subject: [PATCH] feat(cli): show stack progress info in cdk deploy/destroy commands (#22883) closes #22879 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk/lib/cdk-toolkit.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/aws-cdk/lib/cdk-toolkit.ts b/packages/aws-cdk/lib/cdk-toolkit.ts index 320cb82d45128..66c54c4744763 100644 --- a/packages/aws-cdk/lib/cdk-toolkit.ts +++ b/packages/aws-cdk/lib/cdk-toolkit.ts @@ -251,7 +251,8 @@ export class CdkToolkit { } } - print('%s: deploying...', chalk.bold(stack.displayName)); + const stackIndex = stacks.indexOf(stack)+1; + print('%s: deploying... [%s/%s]', chalk.bold(stack.displayName), stackIndex, stackCollection.stackCount); const startDeployTime = new Date().getTime(); let tags = options.tags; @@ -527,8 +528,8 @@ export class CdkToolkit { } const action = options.fromDeploy ? 'deploy' : 'destroy'; - for (const stack of stacks.stackArtifacts) { - success('%s: destroying...', chalk.blue(stack.displayName)); + for (const [index, stack] of stacks.stackArtifacts.entries()) { + success('%s: destroying... [%s/%s]', chalk.blue(stack.displayName), index+1, stacks.stackCount); try { await this.props.cloudFormation.destroyStack({ stack,