Skip to content

Commit

Permalink
fix(CLI): bootstrap shows no hotswap changes when there are no changes (
Browse files Browse the repository at this point in the history
#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*
  • Loading branch information
comcalvi authored Apr 19, 2024
1 parent cc4c96c commit 2126ee5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/aws-cdk/lib/api/deploy-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,13 @@ export async function deployStack(options: DeployStackOptions): Promise<DeploySt
? templateParams.updateExisting(finalParameterValues, cloudFormationStack.parameters)
: templateParams.supplyAll(finalParameterValues);

const hotswapMode = options.hotswap ?? HotswapMode.FULL_DEPLOYMENT;

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

const hotswapMode = options.hotswap;
if (hotswapMode && hotswapMode !== HotswapMode.FULL_DEPLOYMENT) {
if (hotswapMode !== HotswapMode.FULL_DEPLOYMENT) {
// attempt to short-circuit the deployment if possible
try {
const hotswapDeploymentResult = await tryHotswapDeployment(
Expand Down

0 comments on commit 2126ee5

Please sign in to comment.