-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): cdk bootstrap is broken due to --no-execute (#5092)
The change that introduced the `--no-execute` feature (#4852) did not take into account that `cdk bootstrap` uses the same code path for deployment, and therefore `execute` was undefined, and resolved to false (despite the documented default). This change moves `execute` switch from the global scope into `deploy` and to `bootstrap` and passes it into the `cliBootstrap` command, as well as respects the default in case the option passed to the deployment utility is `undefined`. It also emits a message to STDOUT in case `--no-execute` is provided to let user know that deployment hasn't really finished. Otherwise, it appears as if deployment is successful. The `deploy-no-execute` integration test was also "failing successfully" due to invalid usage of bash conditions, so this is also fixed here. Added integration test to verify that --no-execute is respected by `cdk bootstrap`.
- Loading branch information
1 parent
2d92ab3
commit 7acc588
Showing
5 changed files
with
59 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/aws-cdk/test/integ/cli/test-cdk-bootstrap-no-execute.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
scriptdir=$(cd $(dirname $0) && pwd) | ||
source ${scriptdir}/common.bash | ||
# ---------------------------------------------------------- | ||
|
||
setup | ||
|
||
bootstrap_stack_name="toolkit-stack-1-${RANDOM}" | ||
|
||
# deploy with --no-execute (leaves stack in review) | ||
cdk bootstrap --toolkit-stack-name ${bootstrap_stack_name} --no-execute | ||
|
||
response_json=$(mktemp).json | ||
aws cloudformation describe-stacks --stack-name ${bootstrap_stack_name} > ${response_json} | ||
|
||
stack_status=$(node -e "console.log(require('${response_json}').Stacks[0].StackStatus)") | ||
if [ ! "${stack_status}" == "REVIEW_IN_PROGRESS" ]; then | ||
fail "Expected stack to be in status REVIEW_IN_PROGRESS but got ${stack_status}" | ||
fi | ||
|
||
# destroy | ||
aws cloudformation delete-stack --stack-name ${bootstrap_stack_name} | ||
|
||
echo "✅ success" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters