(cli): cdk flags --set always reports no template differences before applying flags
维护者通常 1 天内回复
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- aws, typescript
- 领域
- cli, infrastructure
调研方向
Read packages/aws-cdk/lib/commands/flags/operations.ts, especially FlagOperations.prototypeChanges(), and trace when the app is synthesized and the context store is updated. Reproduce with the TypeScript CDK app and cdk flags --unstable=flags --set --unconfigured --recommended. Done when the preview diff includes the template changes made by the new flag values.
由索引模型根据 Issue 内容生成。
描述
Describe the bug
cdk flags --unstable=flags --set ... (for example --unconfigured --recommended) is supposed to synthesize the app with the current flag values and with the new flag values, show the template diff between the two, and then ask for confirmation.
The diff it shows is always empty (There were no differences / Number of stacks with differences: 0), even for flags that change the template. After accepting, cdk synth shows that the template did change.
Reproduction
Confirmed with CLI 2.1145.0 / aws-cdk-lib 2.272.0.
- Create a project with
cdk init app --language typescript - Remove
@aws-cdk/aws-lambda:useCdkManagedLogGroupfrom thecontextincdk.json, and define onelambda.Functionin the stack - Run
npx cdk flags --unstable=flags --set --unconfigured --recommended
-> the diff says there are no differences - Accept the changes and run
npx cdk synth
-> anAWS::Logs::LogGrouphas been added (it is not in the synth before the change)
Expected behavior
The diff shown before the confirmation prompt includes the template changes caused by the new flag values (here, [+] AWS::Logs::LogGroup).
Root cause
FlagOperations.prototypeChanges() in packages/aws-cdk/lib/commands/flags/operations.ts:
const memoryContext = new MemoryContext(baseContextValues);
...
const source = await this.toolkit.fromCdkApp(app, {
contextStore: memoryContext,
outdir: this.originalTempDir,
});
...
await memoryContext.update(updateObj);
const cx = await this.toolkit.synth(source);
...
const modifiedSource = await this.toolkit.fromCdkApp(app, {
contextStore: memoryContext,
outdir: this.modifiedTempDir,
});
- One
MemoryContextis passed to both the "original" and the "modified"fromCdkApp()sources. fromCdkApp()is lazy: the app is only synthesized, and the context store only read, attoolkit.synth(source).memoryContext.update(updateObj)is called before the firstsynth.
So the "original" assembly is also synthesized with the new flag values, both assemblies are identical, and the diff is always empty.
- 主要语言
- TypeScript
- 星标
- 110
- 派生
- 138
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 56
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
aws/aws-cdk-cli 的其他 Issue
-
aws-cdk bug needs-triage
难度 2/5 1-3 小时 新手友好度 76/100
aws/aws-cdk-cli#2179 ·
维护者通常 1 天内回复
-
(cli): deploy waits forever when an AWS API call gets no response, because requestTimeout only logs a warning可能已有人在做 @abhiramshaji-cyber 于 27 天前认领。 未关闭aws-cdk bug p2
难度 2/5 1-3 小时 新手友好度 76/100
aws/aws-cdk-cli#2097 ·
维护者通常 1 天内回复
-
(bootstrap) FilePublishingRoleDefaultPolicy permission incorrect when FileAssetsBucketKmsKeyId is an ARN value可能已有人在做 @lemon0333 于 95 天前认领。 未关闭bug p2
难度 2/5 1-3 小时 新手友好度 74/100
aws/aws-cdk-cli#921 · 1 条评论 ·
维护者通常 1 天内回复
-
(garbage-collection): cdk gc takes hours on a large bootstrap bucket可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 3/5 1-2 天 新手友好度 72/100
aws/aws-cdk-cli#2165 ·
维护者通常 1 天内回复
-
integ-runner: update workflow fails when deploying an existing snapshot可能已有人在做 @gibkim 于 11 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 32/100
aws/aws-cdk-cli#2150 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
volcengine/OpenViking#8432 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 74/100
jupyterlab/eslint-plugin#178 · 2 条评论 ·
-
bug from-app needs-triage
难度 2/5 1-3 小时 新手友好度 65/100
nightly-labs/openbot#16303 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100