Skip to content

Commit 652b2ec

Browse files
authored
Revert "fix(core): use node.path in skip bundling check for consistency with cdk deploy CLI (#19950)"
This reverts commit 5cff2d9.
1 parent db4524a commit 652b2ec

File tree

2 files changed

+4
-42
lines changed

2 files changed

+4
-42
lines changed

packages/@aws-cdk/core/lib/stack.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,10 +1168,10 @@ export class Stack extends Construct implements ITaggable {
11681168
public get bundlingRequired() {
11691169
const bundlingStacks: string[] = this.node.tryGetContext(cxapi.BUNDLING_STACKS) ?? ['*'];
11701170

1171-
// bundlingStacks is of the form `Stage/Stack`
1171+
// bundlingStacks is of the form `Stage/Stack`, convert it to `Stage-Stack` before comparing to stack name
11721172
return bundlingStacks.some(pattern => minimatch(
1173-
this.node.path, // the same value used for pattern matching in aws-cdk CLI (displayName / hierarchicalId)
1174-
pattern,
1173+
this.stackName,
1174+
pattern.replace('/', '-'),
11751175
));
11761176
}
11771177
}

packages/@aws-cdk/core/test/staging.test.ts

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -908,45 +908,7 @@ describe('staging', () => {
908908
const dockerStubInput = readDockerStubInputConcat();
909909
// Docker ran for the asset in Stack1
910910
expect(dockerStubInput).toMatch(DockerStubCommand.SUCCESS);
911-
// Docker did not run for the asset in Stack2
912-
expect(dockerStubInput).not.toMatch(DockerStubCommand.MULTIPLE_FILES);
913-
});
914-
915-
test('correctly skips bundling with stack under stage and custom stack name', () => {
916-
// GIVEN
917-
const app = new App();
918-
919-
const stage = new Stage(app, 'Stage');
920-
stage.node.setContext(cxapi.BUNDLING_STACKS, ['Stage/Stack1']);
921-
922-
const stack1 = new Stack(stage, 'Stack1', { stackName: 'unrelated-stack1-name' });
923-
const stack2 = new Stack(stage, 'Stack2', { stackName: 'unrelated-stack2-name' });
924-
const directory = path.join(__dirname, 'fs', 'fixtures', 'test1');
925-
926-
// WHEN
927-
new AssetStaging(stack1, 'Asset', {
928-
sourcePath: directory,
929-
assetHashType: AssetHashType.OUTPUT,
930-
bundling: {
931-
image: DockerImage.fromRegistry('alpine'),
932-
command: [DockerStubCommand.SUCCESS],
933-
},
934-
});
935-
936-
new AssetStaging(stack2, 'Asset', {
937-
sourcePath: directory,
938-
assetHashType: AssetHashType.OUTPUT,
939-
bundling: {
940-
image: DockerImage.fromRegistry('alpine'),
941-
command: [DockerStubCommand.MULTIPLE_FILES],
942-
},
943-
});
944-
945-
// THEN
946-
const dockerStubInput = readDockerStubInputConcat();
947-
// Docker ran for the asset in Stack1
948-
expect(dockerStubInput).toMatch(DockerStubCommand.SUCCESS);
949-
// Docker did not run for the asset in Stack2
911+
// DOcker did not run for the asset in Stack2
950912
expect(dockerStubInput).not.toMatch(DockerStubCommand.MULTIPLE_FILES);
951913
});
952914

0 commit comments

Comments
 (0)