fix(deploy): 让 cdk bootstrap 步骤可见、失败可诊断 - #104
Merged
Merged
Conversation
📝 WalkthroughWalkthroughAdds localized "bootstrap running" and "bootstrap failed" messages for Chinese and English locales in config/i18n.json, and updates scripts/deploy.sh's ensure_bootstrap() function to display these messages, run npm install with visible output, disable CDK notices, and handle bootstrap failures with explicit error exit. ChangesBootstrap Messaging and Error Handling
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
bootstrap 之前用 npm install --silent + 无输出的 npx cdk bootstrap,一旦 卡住(npm 源慢、网络到不了 AWS、或只是在等 CloudFormation 建栈)完全看不到 进度,看着像死住。 - 去掉 npm install 的 --silent,装依赖进度可见 - bootstrap 加 CDK_DISABLE_NOTICES=1,避免在访问不了 AWS notices endpoint 的网络(国内常见)上挂几分钟 - 开跑前打印"正在 Bootstrap……通常需 1-2 分钟"提示,区分正常等待与卡死 - 失败时给可操作报错,指向网络 / get-caller-identity / CloudFormation 栈 i18n.json 被 OAuth Lambda 直接 import,新增的 shell 段字符串改变了打包 asset 哈希,故一并刷新 CDK 快照。
ddpie
force-pushed
the
fix/bootstrap-visibility
branch
from
July 8, 2026 10:16
05981a6 to
eb1430a
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
执行 cdk bootstrap这一步的可观测性太差:脚本用npm install --silent+ 无额外输出的npx cdk bootstrap,一旦遇到下面任一情况,屏幕上什么都看不到,看着就像死住了——cdk还会先联网拉一次 notices 公告,能挂好几分钟;CDKToolkit栈建出来(正常 1–2 分钟)。改动
scripts/deploy.sh(ensure_bootstrap)npm install的--silent,装依赖进度可见,源慢/卡住一眼能看出来。CDK_DISABLE_NOTICES=1,跳过 cdk 的联网公告检查,避免在访问不了 notices endpoint 的网络上干等。aws sts get-caller-identity、CloudFormation 控制台里CDKToolkit栈的失败原因。config/i18n.json:新增bootstrap_running/bootstrap_failed两条串,中英各一份。CDK 快照:
config/i18n.json被 OAuth Lambda 直接import,新增 shell 段字符串改变了打包 asset 哈希,故按惯例npm run test:update刷新快照。验证
./scripts/test.sh离线套件全绿(lint / typecheck / vitest / shell)。%s正常替换。cdk bootstrap需连 AWS,未在本地执行;逻辑改动不影响已 bootstrap 区域(脚本仍先探测CDKToolkit栈状态,已存在则跳过)。Background
The
Run cdk bootstrapstep has poor visibility: it runsnpm install --silentplus anpx cdk bootstrapwith no extra output, so whenever any of the following happens the screen shows nothing and it looks hung —cdkalso does a networked notices check first, which can hang for minutes;CDKToolkitstack (a normal 1–2 min).Changes
scripts/deploy.sh(ensure_bootstrap)--silentfromnpm installso install progress is visible.CDK_DISABLE_NOTICES=1to bootstrap, skipping cdk's networked notices check so it can't hang on restricted networks.aws sts get-caller-identity, and theCDKToolkitstack's failure reason in the CloudFormation console.config/i18n.json: addbootstrap_running/bootstrap_failed, zh + en.CDK snapshot:
config/i18n.jsonisimported directly by the OAuth Lambda, so the new shell strings changed its bundle asset hash — refreshed vianpm run test:updateper convention.Verification
./scripts/test.shoffline suite green (lint / typecheck / vitest / shell).%ssubstitutes fine.cdk bootstrapneeds AWS and wasn't run locally; the change is a no-op for already-bootstrapped regions (the script still probesCDKToolkitfirst and skips if present).