Skip to content

Commit 9df7dd3

Browse files
authored
chore(release): v2.132.1 (#29457)
### Issue # (if applicable) Closes #[29420](#29420). ### Reason for this change The latest release has changed the output of the `list` command, removing the path hierarchy. ### Description of changes With the new changes we are looking out for `displayName` first and if it does not exist we fetch the `id`. ### Description of how you validated changes Added unit tests and updated integ tests. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
2 parents 9a51c89 + 79730e6 commit 9df7dd3

File tree

8 files changed

+112
-10
lines changed

8 files changed

+112
-10
lines changed

CHANGELOG.v2.alpha.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
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.
44

5+
## [2.132.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.132.0-alpha.0...v2.132.1-alpha.0) (2024-03-12)
6+
57
## [2.132.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.131.0-alpha.0...v2.132.0-alpha.0) (2024-03-08)
68

79

CHANGELOG.v2.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
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.
44

5+
## [2.132.1](https://github.com/aws/aws-cdk/compare/v2.132.0...v2.132.1) (2024-03-12)
6+
7+
8+
### Bug Fixes
9+
10+
* **cli:** `cdk ls` returns stack id instead of stack display name ([#29447](https://github.com/aws/aws-cdk/issues/29447)) ([effad1c](https://github.com/aws/aws-cdk/commit/effad1cf8a854789070e963691b30fadf1597afb)), closes [#29420](https://github.com/aws/aws-cdk/issues/29420)
11+
512
## [2.132.0](https://github.com/aws/aws-cdk/compare/v2.131.0...v2.132.0) (2024-03-08)
613

714

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This patch brings the [fix](https://github.com/aws/aws-cdk/issues/29420) into the regression suite.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Skipping the test to fix issue https://github.com/aws/aws-cdk/issues/29420.
2+
# cli-integ tests failing for the old tests with the new cli changes for list stacks.
3+
4+
cdk ls --show-dependencies --json

packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -886,10 +886,10 @@ integTest('cdk ls --show-dependencies --json', withDefaultFixture(async (fixture
886886
id: 'list-stacks',
887887
dependencies: [
888888
{
889-
id: 'liststacksDependentStack',
889+
id: 'list-stacks/DependentStack',
890890
dependencies: [
891891
{
892-
id: 'liststacksDependentStackInnerDependentStack',
892+
id: 'list-stacks/DependentStack/InnerDependentStack',
893893
dependencies: [],
894894
},
895895
],
@@ -900,11 +900,11 @@ integTest('cdk ls --show-dependencies --json', withDefaultFixture(async (fixture
900900
id: 'list-multiple-dependent-stacks',
901901
dependencies: [
902902
{
903-
id: 'listmultipledependentstacksDependentStack1',
903+
id: 'list-multiple-dependent-stacks/DependentStack1',
904904
dependencies: [],
905905
},
906906
{
907-
id: 'listmultipledependentstacksDependentStack2',
907+
id: 'list-multiple-dependent-stacks/DependentStack2',
908908
dependencies: [],
909909
},
910910
],

packages/aws-cdk/lib/list-stacks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export async function listStacks(toolkit: CdkToolkit, options: ListStacksOptions
5656

5757
for (const stack of collectionOfStacks.stackArtifacts) {
5858
const data: StackDetails = {
59-
id: stack.id,
59+
id: stack.displayName ?? stack.id,
6060
name: stack.stackName,
6161
environment: stack.environment,
6262
dependencies: [],
@@ -82,7 +82,7 @@ export async function listStacks(toolkit: CdkToolkit, options: ListStacksOptions
8282
}
8383
} else {
8484
data.dependencies.push({
85-
id: depStack.stackArtifacts[0].id,
85+
id: depStack.stackArtifacts[0].displayName ?? depStack.stackArtifacts[0].id,
8686
dependencies: [],
8787
});
8888
}

packages/aws-cdk/test/list-stacks.test.ts

Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ describe('list', () => {
171171
dependencies: [],
172172
},
173173
{
174-
id: 'Test-Stack-B',
174+
id: 'Test-Stack-A/Test-Stack-B',
175175
name: 'Test-Stack-B',
176176
environment: {
177177
account: '123456789012',
@@ -185,7 +185,7 @@ describe('list', () => {
185185
}]));
186186
});
187187

188-
test('stacks with nested dependencies', async () => {
188+
test('stacks with display names and have nested dependencies', async () => {
189189
let cloudExecutable = new MockCloudExecutable({
190190
stacks: [
191191
MockStack.MOCK_STACK_A,
@@ -201,9 +201,84 @@ describe('list', () => {
201201
],
202202
},
203203
depends: ['Test-Stack-A'],
204+
displayName: 'Test-Stack-A/Test-Stack-B',
204205
},
205206
{
206207
stackName: 'Test-Stack-C',
208+
template: { Resources: { TemplateName: 'Test-Stack-C' } },
209+
env: 'aws://123456789012/bermuda-triangle-1',
210+
metadata: {
211+
'/Test-Stack-C': [
212+
{
213+
type: cxschema.ArtifactMetadataEntryType.STACK_TAGS,
214+
},
215+
],
216+
},
217+
depends: ['Test-Stack-B'],
218+
displayName: 'Test-Stack-A/Test-Stack-B/Test-Stack-C',
219+
},
220+
],
221+
});
222+
223+
// GIVEN
224+
const toolkit = new CdkToolkit({
225+
cloudExecutable,
226+
configuration: cloudExecutable.configuration,
227+
sdkProvider: cloudExecutable.sdkProvider,
228+
deployments: cloudFormation,
229+
});
230+
231+
// WHEN
232+
const workflow = await listStacks( toolkit, { selectors: ['Test-Stack-A', 'Test-Stack-A/Test-Stack-B', 'Test-Stack-A/Test-Stack-B/Test-Stack-C'] });
233+
234+
// THEN
235+
expect(JSON.stringify(workflow)).toEqual(JSON.stringify([{
236+
id: 'Test-Stack-A',
237+
name: 'Test-Stack-A',
238+
environment: {
239+
account: '123456789012',
240+
region: 'bermuda-triangle-1',
241+
name: 'aws://123456789012/bermuda-triangle-1',
242+
},
243+
dependencies: [],
244+
},
245+
{
246+
id: 'Test-Stack-A/Test-Stack-B',
247+
name: 'Test-Stack-B',
248+
environment: {
249+
account: '123456789012',
250+
region: 'bermuda-triangle-1',
251+
name: 'aws://123456789012/bermuda-triangle-1',
252+
},
253+
dependencies: [{
254+
id: 'Test-Stack-A',
255+
dependencies: [],
256+
}],
257+
},
258+
{
259+
id: 'Test-Stack-A/Test-Stack-B/Test-Stack-C',
260+
name: 'Test-Stack-C',
261+
environment: {
262+
account: '123456789012',
263+
region: 'bermuda-triangle-1',
264+
name: 'aws://123456789012/bermuda-triangle-1',
265+
},
266+
dependencies: [{
267+
id: 'Test-Stack-A/Test-Stack-B',
268+
dependencies: [{
269+
id: 'Test-Stack-A',
270+
dependencies: [],
271+
}],
272+
}],
273+
}]));
274+
});
275+
276+
test('stacks with nested dependencies', async () => {
277+
let cloudExecutable = new MockCloudExecutable({
278+
stacks: [
279+
MockStack.MOCK_STACK_A,
280+
{
281+
stackName: 'Test-Stack-B',
207282
template: { Resources: { TemplateName: 'Test-Stack-B' } },
208283
env: 'aws://123456789012/bermuda-triangle-1',
209284
metadata: {
@@ -213,6 +288,19 @@ describe('list', () => {
213288
},
214289
],
215290
},
291+
depends: ['Test-Stack-A'],
292+
},
293+
{
294+
stackName: 'Test-Stack-C',
295+
template: { Resources: { TemplateName: 'Test-Stack-C' } },
296+
env: 'aws://123456789012/bermuda-triangle-1',
297+
metadata: {
298+
'/Test-Stack-C': [
299+
{
300+
type: cxschema.ArtifactMetadataEntryType.STACK_TAGS,
301+
},
302+
],
303+
},
216304
depends: ['Test-Stack-B'],
217305
},
218306
],

version.v2.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"version": "2.132.0",
3-
"alphaVersion": "2.132.0-alpha.0"
2+
"version": "2.132.1",
3+
"alphaVersion": "2.132.1-alpha.0"
44
}

0 commit comments

Comments
 (0)