diff --git a/CHANGELOG.v2.md b/CHANGELOG.v2.md index aa21229726637..2d053ed58a41b 100644 --- a/CHANGELOG.v2.md +++ b/CHANGELOG.v2.md @@ -9,6 +9,11 @@ All notable changes to this project will be documented in this file. See [standa * **cli:** pin geonamescache dependency to 1.3 (backport [#21152](https://github.com/aws/aws-cdk/issues/21152)) ([#21157](https://github.com/aws/aws-cdk/issues/21157)) ([32846f9](https://github.com/aws/aws-cdk/commit/32846f9680e39813f6ff299339aa060b1840ec73)) + +### Reverts + +* **core:** revert "fix(core): use node.path in skip bundling check for consistency with cdk deploy CLI" ([#21174](https://github.com/aws/aws-cdk/issues/21174)) ([05ac2d8](https://github.com/aws/aws-cdk/commit/05ac2d841b124f341302070c63b80764ffcf8464)), closes [#19950](https://github.com/aws/aws-cdk/issues/19950) + ## [2.32.0](https://github.com/aws/aws-cdk/compare/v2.31.2...v2.32.0) (2022-07-14) diff --git a/packages/@aws-cdk/core/lib/stack.ts b/packages/@aws-cdk/core/lib/stack.ts index 325863d2a92fd..23097a90914f2 100644 --- a/packages/@aws-cdk/core/lib/stack.ts +++ b/packages/@aws-cdk/core/lib/stack.ts @@ -1168,10 +1168,10 @@ export class Stack extends Construct implements ITaggable { public get bundlingRequired() { const bundlingStacks: string[] = this.node.tryGetContext(cxapi.BUNDLING_STACKS) ?? ['*']; - // bundlingStacks is of the form `Stage/Stack` + // bundlingStacks is of the form `Stage/Stack`, convert it to `Stage-Stack` before comparing to stack name return bundlingStacks.some(pattern => minimatch( - this.node.path, // the same value used for pattern matching in aws-cdk CLI (displayName / hierarchicalId) - pattern, + this.stackName, + pattern.replace('/', '-'), )); } } diff --git a/packages/@aws-cdk/core/test/staging.test.ts b/packages/@aws-cdk/core/test/staging.test.ts index aa8e57814c98a..087c16a2bbb0d 100644 --- a/packages/@aws-cdk/core/test/staging.test.ts +++ b/packages/@aws-cdk/core/test/staging.test.ts @@ -869,45 +869,7 @@ describe('staging', () => { const dockerStubInput = readDockerStubInputConcat(); // Docker ran for the asset in Stack1 expect(dockerStubInput).toMatch(DockerStubCommand.SUCCESS); - // Docker did not run for the asset in Stack2 - expect(dockerStubInput).not.toMatch(DockerStubCommand.MULTIPLE_FILES); - }); - - test('correctly skips bundling with stack under stage and custom stack name', () => { - // GIVEN - const app = new App(); - - const stage = new Stage(app, 'Stage'); - stage.node.setContext(cxapi.BUNDLING_STACKS, ['Stage/Stack1']); - - const stack1 = new Stack(stage, 'Stack1', { stackName: 'unrelated-stack1-name' }); - const stack2 = new Stack(stage, 'Stack2', { stackName: 'unrelated-stack2-name' }); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - new AssetStaging(stack1, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - new AssetStaging(stack2, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.MULTIPLE_FILES], - }, - }); - - // THEN - const dockerStubInput = readDockerStubInputConcat(); - // Docker ran for the asset in Stack1 - expect(dockerStubInput).toMatch(DockerStubCommand.SUCCESS); - // Docker did not run for the asset in Stack2 + // DOcker did not run for the asset in Stack2 expect(dockerStubInput).not.toMatch(DockerStubCommand.MULTIPLE_FILES); });