Skip to content

Commit c4d3487

Browse files
committed
feat(cli): add a switch to display all stack events
closes #8696
1 parent f249e61 commit c4d3487

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

packages/aws-cdk/bin/cdk.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,11 @@ async function parseCommandLineArguments() {
9090
.option('parameters', { type: 'array', desc: 'Additional parameters passed to CloudFormation at deploy time (STACK:KEY=VALUE)', nargs: 1, requiresArg: true, default: {} })
9191
.option('outputs-file', { type: 'string', alias: 'O', desc: 'Path to file where stack outputs will be written as JSON', requiresArg: true })
9292
.option('previous-parameters', { type: 'boolean', default: true, desc: 'Use previous values for existing parameters (you must specify all parameters on every deployment if this is disabled)' })
93-
.option('trunc', { type: 'boolean', desc: 'Display only stack activity events for the resource currently being updated', default: false}),
93+
.option('all-events', { type: 'boolean', desc: 'Display all stack activity events. Default setting displays events for the resource currently being updated', default: false}),
9494
)
9595
.command('destroy [STACKS..]', 'Destroy the stack(s) named STACKS', yargs => yargs
9696
.option('exclusively', { type: 'boolean', alias: 'e', desc: 'Only destroy requested stacks, don\'t include dependees' })
9797
.option('force', { type: 'boolean', alias: 'f', desc: 'Do not ask for confirmation before destroying the stacks' }))
98-
.option('trunc', { type: 'boolean', desc: 'Display only stack activity events for the resource currently being updated', default: false})
9998
.command('diff [STACKS..]', 'Compares the specified stack with the deployed stack or a local template file, and returns with status 1 if any difference is found', yargs => yargs
10099
.option('exclusively', { type: 'boolean', alias: 'e', desc: 'Only diff requested stacks, don\'t include dependencies' })
101100
.option('context-lines', { type: 'number', desc: 'Number of context lines to include in arbitrary JSON diff rendering', default: 3, requiresArg: true })
@@ -281,7 +280,7 @@ async function initCommandLine() {
281280
parameters: parameterMap,
282281
usePreviousParameters: args['previous-parameters'],
283282
outputsFile: args.outputsFile,
284-
trunc: args.trunc,
283+
allEvents: args.allEvents,
285284
});
286285

287286
case 'destroy':

packages/aws-cdk/lib/api/cloudformation-deployments.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ export interface DeployStackOptions {
9090
usePreviousParameters?: boolean;
9191

9292
/**
93-
* Whether to truncate stack events to display only the
93+
* Whether to display all stack events or to display only the events for the
9494
* resource currently being deployed
9595
*
9696
* If not set, the stack history with all stack events will be displayed
9797
*
9898
* @default false
9999
*/
100-
trunc?: boolean;
100+
allEvents?: boolean;
101101
}
102102

103103
export interface DestroyStackOptions {
@@ -166,7 +166,7 @@ export class CloudFormationDeployments {
166166
force: options.force,
167167
parameters: options.parameters,
168168
usePreviousParameters: options.usePreviousParameters,
169-
trunc: options.trunc,
169+
allEvents: options.allEvents,
170170
});
171171
}
172172

packages/aws-cdk/lib/api/deploy-stack.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ export interface DeployStackOptions {
154154
usePreviousParameters?: boolean;
155155

156156
/**
157-
* Whether to truncate stack events to display only the
157+
* Whether to display all stack events or to display only the events for the
158158
* resource currently being deployed
159159
*
160160
* If not set, the stack history with all stack events will be displayed
161161
*
162162
* @default false
163163
*/
164-
trunc?: boolean;
164+
allEvents?: boolean;
165165

166166
/**
167167
* Deploy even if the deployed template is identical to the one we are about to deploy.
@@ -270,6 +270,7 @@ export async function deployStack(options: DeployStackOptions): Promise<DeploySt
270270
// eslint-disable-next-line max-len
271271
const monitor = options.quiet ? undefined : new StackActivityMonitor(cfn, deployName, stackArtifact, {
272272
resourcesTotal: (changeSetDescription.Changes ?? []).length,
273+
allEvents: options.allEvents,
273274
}).start();
274275
debug('Execution of changeset %s on stack %s has started; waiting for the update to complete...', changeSetName, deployName);
275276
try {

packages/aws-cdk/lib/api/util/cloudformation/stack-activity-monitor.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ export interface StackActivityMonitorProps {
3737
readonly logLevel?: LogLevel;
3838

3939
/**
40-
* Whether to truncate stack events to display only the
40+
* Whether to display all stack events or to display only the events for the
4141
* resource currently being deployed
4242
*
4343
* If not set, the stack history with all stack events will be displayed
4444
*
4545
* @default false
4646
*/
47-
trunc?: boolean;
47+
allEvents?: boolean;
4848
}
4949

5050
export class StackActivityMonitor {
@@ -90,9 +90,9 @@ export class StackActivityMonitor {
9090
const isWindows = process.platform === 'win32';
9191
const verbose = options.logLevel ?? logLevel;
9292
const fancyOutputAvailable = !isWindows && stream.isTTY;
93-
const trunc = options.trunc ?? false;
93+
const allEvents = options.allEvents ?? false;
9494

95-
this.printer = fancyOutputAvailable && !trunc && !verbose
95+
this.printer = fancyOutputAvailable && !allEvents && !verbose
9696
? new CurrentActivityPrinter(props)
9797
: new HistoryActivityPrinter(props);
9898
}

packages/aws-cdk/lib/cdk-toolkit.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export class CdkToolkit {
190190
force: options.force,
191191
parameters: Object.assign({}, parameterMap['*'], parameterMap[stack.stackName]),
192192
usePreviousParameters: options.usePreviousParameters,
193-
trunc: options.trunc,
193+
allEvents: options.allEvents,
194194
});
195195

196196
const message = result.noOp
@@ -580,14 +580,14 @@ export interface DeployOptions {
580580
usePreviousParameters?: boolean;
581581

582582
/**
583-
* Whether to truncate stack events to display only the
583+
* Whether to display all stack events or to display only the events for the
584584
* resource currently being deployed
585585
*
586586
* If not set, the stack history with all stack events will be displayed
587587
*
588588
* @default false
589589
*/
590-
trunc?: boolean;
590+
allEvents?: boolean;
591591

592592
/**
593593
* Path to file where stack outputs will be written after a successful deploy as JSON

0 commit comments

Comments
 (0)