Skip to content

Commit e7dc40a

Browse files
committed
wip
1 parent 7b8ef5b commit e7dc40a

File tree

5 files changed

+48
-2
lines changed

5 files changed

+48
-2
lines changed

packages/aws-cdk/bin/cdk.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,13 @@ async function parseCommandLineArguments() {
8989
.option('force', { alias: 'f', type: 'boolean', desc: 'Always deploy stack even if templates are identical', default: false })
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 })
92-
.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)' }),
92+
.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}),
9394
)
9495
.command('destroy [STACKS..]', 'Destroy the stack(s) named STACKS', yargs => yargs
9596
.option('exclusively', { type: 'boolean', alias: 'e', desc: 'Only destroy requested stacks, don\'t include dependees' })
9697
.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})
9799
.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
98100
.option('exclusively', { type: 'boolean', alias: 'e', desc: 'Only diff requested stacks, don\'t include dependencies' })
99101
.option('context-lines', { type: 'number', desc: 'Number of context lines to include in arbitrary JSON diff rendering', default: 3, requiresArg: true })
@@ -279,6 +281,7 @@ async function initCommandLine() {
279281
parameters: parameterMap,
280282
usePreviousParameters: args['previous-parameters'],
281283
outputsFile: args.outputsFile,
284+
trunc: args.trunc,
282285
});
283286

284287
case 'destroy':

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

+11
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ export interface DeployStackOptions {
8888
* @default true
8989
*/
9090
usePreviousParameters?: boolean;
91+
92+
/**
93+
* Whether to truncate stack events to display only the
94+
* resource currently being deployed
95+
*
96+
* If not set, the stack history with all stack events will be displayed
97+
*
98+
* @default false
99+
*/
100+
trunc?: boolean;
91101
}
92102

93103
export interface DestroyStackOptions {
@@ -156,6 +166,7 @@ export class CloudFormationDeployments {
156166
force: options.force,
157167
parameters: options.parameters,
158168
usePreviousParameters: options.usePreviousParameters,
169+
trunc: options.trunc,
159170
});
160171
}
161172

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

+10
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,16 @@ export interface DeployStackOptions {
153153
*/
154154
usePreviousParameters?: boolean;
155155

156+
/**
157+
* Whether to truncate stack events to display only the
158+
* resource currently being deployed
159+
*
160+
* If not set, the stack history with all stack events will be displayed
161+
*
162+
* @default false
163+
*/
164+
trunc?: boolean;
165+
156166
/**
157167
* Deploy even if the deployed template is identical to the one we are about to deploy.
158168
* @default false

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

+12-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ export interface StackActivityMonitorProps {
3535
* @default - Use value from logging.logLevel
3636
*/
3737
readonly logLevel?: LogLevel;
38+
39+
/**
40+
* Whether to truncate stack events to display only the
41+
* resource currently being deployed
42+
*
43+
* If not set, the stack history with all stack events will be displayed
44+
*
45+
* @default false
46+
*/
47+
trunc?: boolean;
3848
}
3949

4050
export class StackActivityMonitor {
@@ -80,8 +90,9 @@ export class StackActivityMonitor {
8090
const isWindows = process.platform === 'win32';
8191
const verbose = options.logLevel ?? logLevel;
8292
const fancyOutputAvailable = !isWindows && stream.isTTY;
93+
const trunc = options.trunc ?? false;
8394

84-
this.printer = fancyOutputAvailable && !verbose
95+
this.printer = fancyOutputAvailable && !trunc && !verbose
8596
? new CurrentActivityPrinter(props)
8697
: new HistoryActivityPrinter(props);
8798
}

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

+11
Original file line numberDiff line numberDiff line change
@@ -190,6 +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,
193194
});
194195

195196
const message = result.noOp
@@ -578,6 +579,16 @@ export interface DeployOptions {
578579
*/
579580
usePreviousParameters?: boolean;
580581

582+
/**
583+
* Whether to truncate stack events to display only the
584+
* resource currently being deployed
585+
*
586+
* If not set, the stack history with all stack events will be displayed
587+
*
588+
* @default false
589+
*/
590+
trunc?: boolean;
591+
581592
/**
582593
* Path to file where stack outputs will be written after a successful deploy as JSON
583594
* @default - Outputs are not written to any file

0 commit comments

Comments
 (0)