Skip to content

Commit fa16f7a

Browse files
authored
fix(cli): cdk version displays notices (#19181)
One of our integration tests started failing after a [notice](https://github.com/aws/aws-cdk-rfcs/blob/master/text/0308-cli-advisories.md) was added because `cdk version` displayed information besides the actual CLI version: ``` ● Two ways of shoing the version expect(received).toEqual(expected) // deep equality - Expected - 0 + Received + 14 2.14.0 (build 762d71b) + + NOTICES + + 19179 (aws-eks): Regression in installing Helm charts from assets + + Overview: Helm charts fail to install when provided as an asset. This + issue does not affect charts installed from a repository. + + Affected versions: framework: 2.14.0, framework: 1.146.0 + + More information at: #19179 + + + If you don’t want to see a notice anymore, use "cdk acknowledge <id>". For example, "cdk acknowledge 19179". at cli.integtest.ts:39:20 at ../helpers/cdk.ts:130:7 at ResourcePool.using (../helpers/resource-pool.ts:44:14) at ../helpers/test-helpers.ts:30:14 ``` This fixes that bug. Another option we could consider here is to keep the current behavior (where `cdk version` and `cdk --version` display different output) and just update the test case, but I think keeping them the same is probably simpler for customers. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent a6b0a10 commit fa16f7a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/aws-cdk/lib/cli.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ async function initCommandLine() {
318318
acknowledgedIssueNumbers: [],
319319
ignoreCache: true,
320320
});
321-
} else {
321+
} else if (cmd !== 'version') {
322322
await displayNotices({
323323
outdir: configuration.settings.get(['output']) ?? 'cdk.out',
324324
acknowledgedIssueNumbers: configuration.context.get('acknowledged-issue-numbers') ?? [],

packages/aws-cdk/test/integ/cli/cli.integtest.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ integTest('Construct with builtin Lambda function', withDefaultFixture(async (fi
3232
await fixture.cdkDestroy('builtin-lambda-function');
3333
}));
3434

35-
integTest('Two ways of shoing the version', withDefaultFixture(async (fixture) => {
35+
integTest('Two ways of showing the version', withDefaultFixture(async (fixture) => {
3636
const version1 = await fixture.cdk(['version'], { verbose: false });
3737
const version2 = await fixture.cdk(['--version'], { verbose: false });
3838

0 commit comments

Comments
 (0)