From bad64f483b4ef25ad8896cc2d3eef49049cf6ef4 Mon Sep 17 00:00:00 2001 From: Calvin Combs Date: Thu, 2 Sep 2021 09:58:28 -0700 Subject: [PATCH] moved defaulting logic to deploy-stack.ts --- packages/aws-cdk/bin/cdk.ts | 5 ++--- packages/aws-cdk/lib/api/deploy-stack.ts | 14 +++++--------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/packages/aws-cdk/bin/cdk.ts b/packages/aws-cdk/bin/cdk.ts index 8465f17af403f..aaaef0deb3182 100644 --- a/packages/aws-cdk/bin/cdk.ts +++ b/packages/aws-cdk/bin/cdk.ts @@ -105,7 +105,7 @@ async function parseCommandLineArguments() { .option('outputs-file', { type: 'string', alias: 'O', desc: 'Path to file where stack outputs will be written as JSON', requiresArg: true }) .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)' }) .option('progress', { type: 'string', choices: [StackActivityProgress.BAR, StackActivityProgress.EVENTS], desc: 'Display mode for stack activity events' }) - .option('rollback', { type: 'boolean', default: undefined, desc: 'Rollback stack to stable state on failure (iterate more rapidly with --no-rollback or -R)' }) + .option('rollback', { type: 'boolean', desc: 'Rollback stack to stable state on failure (iterate more rapidly with --no-rollback or -R)' }) // Hack to get '-R' as an alias for '--no-rollback', suggested by: https://github.com/yargs/yargs/issues/1729 .option('R', { type: 'boolean', hidden: true }) .middleware(yargsNegativeAlias('R', 'rollback'), true) @@ -115,8 +115,7 @@ async function parseCommandLineArguments() { 'which skips CloudFormation and updates the resources directly, ' + 'and falls back to a full deployment if that is not possible. ' + 'Do not use this in production environments', - }) - .option('progress', { type: 'string', choices: [StackActivityProgress.BAR, StackActivityProgress.EVENTS], desc: 'Display mode for stack activity events' }), + }), ) .command('destroy [STACKS..]', 'Destroy the stack(s) named STACKS', yargs => yargs .option('all', { type: 'boolean', default: false, desc: 'Destroy all available stacks' }) diff --git a/packages/aws-cdk/lib/api/deploy-stack.ts b/packages/aws-cdk/lib/api/deploy-stack.ts index 3105d23fc00da..a40dc46194a4a 100644 --- a/packages/aws-cdk/lib/api/deploy-stack.ts +++ b/packages/aws-cdk/lib/api/deploy-stack.ts @@ -185,7 +185,7 @@ export interface DeployStackOptions { * * @default true */ - readonly rollback?: boolean; + rollback?: boolean; /* * Whether to perform a 'hotswap' deployment. @@ -250,6 +250,9 @@ export async function deployStack(options: DeployStackOptions): Promise