diff --git a/CHANGELOG.v2.alpha.md b/CHANGELOG.v2.alpha.md index 3cd0e7ba45421..e269fa83758ad 100644 --- a/CHANGELOG.v2.alpha.md +++ b/CHANGELOG.v2.alpha.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.203.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.203.0-alpha.0...v2.203.1-alpha.0) (2025-07-02) + ## [2.203.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.202.0-alpha.0...v2.203.0-alpha.0) (2025-07-01) diff --git a/CHANGELOG.v2.md b/CHANGELOG.v2.md index 421803de85e95..7febee94497f2 100644 --- a/CHANGELOG.v2.md +++ b/CHANGELOG.v2.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.203.1](https://github.com/aws/aws-cdk/compare/v2.203.0...v2.203.1) (2025-07-02) + +### Bug Fixes + +* "Invalid Assembly Manifest" when used with CLI 2.1017.0 and 2.1018.0 ([#34880](https://github.com/aws/aws-cdk/issues/34880)) ([32ee050](https://github.com/aws/aws-cdk/commit/32ee0504a83647a88b24361094ef76aef18e7b8b)), closes [aws/aws-cdk#34798](https://github.com/aws/aws-cdk/issues/34798) + ## [2.203.0](https://github.com/aws/aws-cdk/compare/v2.202.0...v2.203.0) (2025-07-01) diff --git a/packages/aws-cdk-lib/core/lib/private/feature-flag-report.ts b/packages/aws-cdk-lib/core/lib/private/feature-flag-report.ts deleted file mode 100644 index 40066e140d4cc..0000000000000 --- a/packages/aws-cdk-lib/core/lib/private/feature-flag-report.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { ArtifactType, FeatureFlag } from '@aws-cdk/cloud-assembly-schema'; -import { IConstruct } from 'constructs'; -import { CloudAssemblyBuilder } from '../../../cx-api'; -import * as feats from '../../../cx-api/lib/features'; -import { FlagInfo } from '../../../cx-api/lib/private/flag-modeling'; - -/** - * Creates a FeatureFlag object based on flag information given. - */ -function parseFeatureFlagInfo(flagName: string, info: FlagInfo, root: IConstruct): FeatureFlag { - const userValue = root.node.tryGetContext(flagName) ?? undefined; - - let parsedFlag: FeatureFlag = { - userValue: userValue, - recommendedValue: info.recommendedValue, - explanation: info.summary, - }; - - return parsedFlag; -} - -/** - * Iterate through all feature flags, retrieve the user's context, - * and create a Feature Flag report. - */ -export function generateFeatureFlagReport(builder: CloudAssemblyBuilder, root: IConstruct): void { - const featureFlags: Record = {}; - for (const [flagName, flagInfo] of Object.entries(feats.FLAGS)) { - featureFlags[flagName] = parseFeatureFlagInfo(flagName, flagInfo, root); - } - - builder.addArtifact('aws-cdk-lib/feature-flag-report', { - type: ArtifactType.FEATURE_FLAG_REPORT, - properties: { - module: 'aws-cdk-lib', - flags: featureFlags, - }, - }); -} diff --git a/packages/aws-cdk-lib/core/lib/private/synthesis.ts b/packages/aws-cdk-lib/core/lib/private/synthesis.ts index 5bae10a8c8189..6a5c72facd265 100644 --- a/packages/aws-cdk-lib/core/lib/private/synthesis.ts +++ b/packages/aws-cdk-lib/core/lib/private/synthesis.ts @@ -15,7 +15,6 @@ import { Stack } from '../stack'; import { ISynthesisSession } from '../stack-synthesizers/types'; import { Stage, StageSynthesisOptions } from '../stage'; import { IPolicyValidationPluginBeta1 } from '../validation'; -import { generateFeatureFlagReport } from './feature-flag-report'; import { ConstructTree } from '../validation/private/construct-tree'; import { PolicyValidationReportFormatter, NamedValidationPluginReport } from '../validation/private/report'; @@ -65,8 +64,6 @@ export function synthesize(root: IConstruct, options: SynthesisOptions = { }): c // stacks to add themselves to the synthesized cloud assembly. synthesizeTree(root, builder, options.validateOnSynthesis); - generateFeatureFlagReport(builder, root); - const assembly = builder.buildAssembly(); invokeValidationPlugins(root, builder.outdir, assembly); diff --git a/packages/aws-cdk-lib/core/test/feature-flag-report.test.ts b/packages/aws-cdk-lib/core/test/feature-flag-report.test.ts deleted file mode 100644 index bb177ac1862a9..0000000000000 --- a/packages/aws-cdk-lib/core/test/feature-flag-report.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { FeatureFlagReportProperties } from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '../../cx-api'; -import { App } from '../lib'; -import { generateFeatureFlagReport } from '../lib/private/feature-flag-report'; - -describe('generate feature flag report', () => { - test('feature flag report can be retrieved from CloudAssembly using its artifact ID', () => { - const app = new App(); - const assembly = app.synth(); - expect(assembly.manifest.artifacts?.['aws-cdk-lib/feature-flag-report']).toBeDefined(); - }); - test('report contains context values that represent the feature flags', () => { - const app = new App({ - context: { - '@aws-cdk/aws-ec2:bastionHostUseAmazonLinux2023ByDefault': true, - '@aws-cdk/core:aspectStabilization': false, - }, - }); - const assembly = app.synth(); - const report = assembly.manifest.artifacts?.['aws-cdk-lib/feature-flag-report']; - expect(report).toEqual(expect.objectContaining({ - type: 'cdk:feature-flag-report', - properties: expect.objectContaining({ - module: 'aws-cdk-lib', - flags: expect.objectContaining({ - '@aws-cdk/aws-ec2:bastionHostUseAmazonLinux2023ByDefault': expect.objectContaining({ - userValue: true, - }), - '@aws-cdk/core:aspectStabilization': expect.objectContaining({ - userValue: false, - }), - }), - }), - })); - }); - test('defaults userValue to undefined when not set in context', () => { - const app = new App(); - const builder = new cxapi.CloudAssemblyBuilder('/tmp/test'); - const spy = jest.spyOn(builder, 'addArtifact'); - - generateFeatureFlagReport(builder, app); - - const flags = (spy.mock.calls[0][1].properties as FeatureFlagReportProperties).flags; - expect(flags).toEqual(expect.objectContaining({ - '@aws-cdk/aws-ec2:bastionHostUseAmazonLinux2023ByDefault': expect.objectContaining({ - userValue: undefined, - }), - })); - }); -}); - diff --git a/packages/aws-cdk-lib/core/test/stage.test.ts b/packages/aws-cdk-lib/core/test/stage.test.ts index 70e56cf7fe798..4c113c96e1e69 100644 --- a/packages/aws-cdk-lib/core/test/stage.test.ts +++ b/packages/aws-cdk-lib/core/test/stage.test.ts @@ -252,7 +252,7 @@ describe('stage', () => { const rootAssembly = app.synth(); // THEN - expect(rootAssembly.manifest.artifacts).toMatchObject({ + expect(rootAssembly.manifest.artifacts).toEqual({ 'assembly-StageLevel1': { type: 'cdk:cloud-assembly', properties: { @@ -263,7 +263,7 @@ describe('stage', () => { }); const assemblyLevel1 = rootAssembly.getNestedAssembly('assembly-StageLevel1'); - expect(assemblyLevel1.manifest.artifacts).toMatchObject({ + expect(assemblyLevel1.manifest.artifacts).toEqual({ 'assembly-StageLevel1-StageLevel2': { type: 'cdk:cloud-assembly', properties: { @@ -274,7 +274,7 @@ describe('stage', () => { }); const assemblyLevel2 = assemblyLevel1.getNestedAssembly('assembly-StageLevel1-StageLevel2'); - expect(assemblyLevel2.manifest.artifacts).toMatchObject({ + expect(assemblyLevel2.manifest.artifacts).toEqual({ 'assembly-StageLevel1-StageLevel2-StageLevel3': { type: 'cdk:cloud-assembly', properties: { diff --git a/packages/aws-cdk-lib/core/test/synthesis.test.ts b/packages/aws-cdk-lib/core/test/synthesis.test.ts index f92bde7131030..65e9a6df24012 100644 --- a/packages/aws-cdk-lib/core/test/synthesis.test.ts +++ b/packages/aws-cdk-lib/core/test/synthesis.test.ts @@ -24,7 +24,7 @@ describe('synthesis', () => { // THEN expect(app.synth()).toEqual(session); // same session if we synth() again expect(list(session.directory)).toEqual(['cdk.out', 'manifest.json', 'tree.json']); - expect(readJson(session.directory, 'manifest.json').artifacts).toMatchObject({ + expect(readJson(session.directory, 'manifest.json').artifacts).toEqual({ Tree: { type: 'cdk:tree', properties: { file: 'tree.json' }, diff --git a/version.v2.json b/version.v2.json index 8bac079db364a..d1a4e57fc4469 100644 --- a/version.v2.json +++ b/version.v2.json @@ -1,4 +1,4 @@ { - "version": "2.203.0", - "alphaVersion": "2.203.0-alpha.0" + "version": "2.203.1", + "alphaVersion": "2.203.1-alpha.0" } \ No newline at end of file