Skip to content

Commit 2126ee5

Browse files
authored
fix(CLI): bootstrap shows no hotswap changes when there are no changes (#29877)
### Issue # (if applicable) Closes #25736. ### Reason for this change The bootstrap calls `deployStack` without specifying hotswap, and `deployStack` does not correctly default the hotswap mode to `FULL_DEPLOYMENT`. ### Description of changes Make `deployStack` correctly default `hotswapMode` to `FULL_DEPLOYMENT`. ### Description of how you validated changes Manual testing. Before this change: ``` ✨ hotswap deployment skipped - no changes were detected (use --force to override) ✅ Environment aws://123456789012/us-east-1 bootstrapped (no changes). ``` After: ``` ✅ Environment aws://123456789012/us-east-1 bootstrapped (no changes). ``` Unit tests not added because we don't have any unit tests for bootstrap and this is cosmetic. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent cc4c96c commit 2126ee5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,13 @@ export async function deployStack(options: DeployStackOptions): Promise<DeploySt
262262
? templateParams.updateExisting(finalParameterValues, cloudFormationStack.parameters)
263263
: templateParams.supplyAll(finalParameterValues);
264264

265+
const hotswapMode = options.hotswap ?? HotswapMode.FULL_DEPLOYMENT;
266+
265267
if (await canSkipDeploy(options, cloudFormationStack, stackParams.hasChanges(cloudFormationStack.parameters))) {
266268
debug(`${deployName}: skipping deployment (use --force to override)`);
267269
// if we can skip deployment and we are performing a hotswap, let the user know
268270
// that no hotswap deployment happened
269-
if (options.hotswap !== HotswapMode.FULL_DEPLOYMENT) {
271+
if (hotswapMode !== HotswapMode.FULL_DEPLOYMENT) {
270272
print(`\n ${ICON} %s\n`, chalk.bold('hotswap deployment skipped - no changes were detected (use --force to override)'));
271273
}
272274
return {
@@ -289,8 +291,7 @@ export async function deployStack(options: DeployStackOptions): Promise<DeploySt
289291
parallel: options.assetParallelism,
290292
});
291293

292-
const hotswapMode = options.hotswap;
293-
if (hotswapMode && hotswapMode !== HotswapMode.FULL_DEPLOYMENT) {
294+
if (hotswapMode !== HotswapMode.FULL_DEPLOYMENT) {
294295
// attempt to short-circuit the deployment if possible
295296
try {
296297
const hotswapDeploymentResult = await tryHotswapDeployment(

0 commit comments

Comments
 (0)