Skip to content

Commit

Permalink
Merge branch 'master' into bump-cfnspec/v46.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
iliapolo authored Nov 4, 2021
2 parents bf7ebe9 + c8cd515 commit c51f955
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
7 changes: 1 addition & 6 deletions pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,12 @@ function lerna_scopes() {
# Compile examples with respect to "decdk" directory, as all packages will
# be symlinked there so they can all be included.
echo "Extracting code samples" >&2
$ROSETTA extract \
node --experimental-worker $(which $ROSETTA) \
--compile \
--output samples.tabl.json \
--directory packages/decdk \
$(cat $TMPDIR/jsii.txt)

echo "Infusing examples back into assemblies" >&2
$ROSETTA infuse \
samples.tabl.json \
$(cat $TMPDIR/jsii.txt)

# Jsii packaging (all at once using jsii-pacmak)
echo "Packaging jsii modules" >&2
$PACMAK \
Expand Down
9 changes: 6 additions & 3 deletions packages/aws-cdk/bin/cdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,13 @@ 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', 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. Defaults to 'true', iterate more rapidly with --no-rollback or -R. " +
'Note: do **not** disable this flag for deployments with resource replacements, as that will always fail',
})
// 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)
.option('R', { type: 'boolean', hidden: true }).middleware(yargsNegativeAlias('R', 'rollback'), true)
.option('hotswap', {
type: 'boolean',
desc: "Attempts to perform a 'hotswap' deployment, " +
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk/lib/api/deploy-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ async function prepareAndExecuteChangeSet(
if (execute) {
debug('Initiating execution of changeset %s on stack %s', changeSet.Id, deployName);

const shouldDisableRollback = (options.rollback === undefined && options.hotswap === true) || options.rollback === false;
const shouldDisableRollback = options.rollback === false;
// Do a bit of contortions to only pass the `DisableRollback` flag if it's true. That way,
// CloudFormation won't balk at the unrecognized option in regions where the feature is not available yet.
const disableRollback = shouldDisableRollback ? { DisableRollback: true } : undefined;
Expand Down
1 change: 1 addition & 0 deletions packages/aws-cdk/lib/cdk-toolkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ export interface DeployOptions {
* @default true
*/
readonly rollback?: boolean;

/*
* Whether to perform a 'hotswap' deployment.
* A 'hotswap' deployment will attempt to short-circuit CloudFormation
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-cdk/test/api/deploy-stack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ test("does not call tryHotswapDeployment() if 'hotswap' is false", async () => {
expect(tryHotswapDeployment).not.toHaveBeenCalled();
});

test("rollback defaults to disabled if 'hotswap' is true", async () => {
test("rollback still defaults to enabled even if 'hotswap' is enabled", async () => {
// WHEN
await deployStack({
...standardDeployStackArguments(),
Expand All @@ -107,7 +107,7 @@ test("rollback defaults to disabled if 'hotswap' is true", async () => {
});

// THEN
expect(cfnMocks.executeChangeSet).toHaveBeenCalledWith(expect.objectContaining({
expect(cfnMocks.executeChangeSet).not.toHaveBeenCalledWith(expect.objectContaining({
DisableRollback: true,
}));
});
Expand Down

0 comments on commit c51f955

Please sign in to comment.