Skip to content

Commit

Permalink
chore(release): v2.132.1 (#29457)
Browse files Browse the repository at this point in the history
### 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*
  • Loading branch information
mergify[bot] committed Mar 12, 2024
2 parents 9a51c89 + 79730e6 commit 9df7dd3
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.v2.alpha.md
Expand Up @@ -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.132.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.132.0-alpha.0...v2.132.1-alpha.0) (2024-03-12)

## [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)


Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.v2.md
Expand Up @@ -2,6 +2,13 @@

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.132.1](https://github.com/aws/aws-cdk/compare/v2.132.0...v2.132.1) (2024-03-12)


### Bug Fixes

* **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)

## [2.132.0](https://github.com/aws/aws-cdk/compare/v2.131.0...v2.132.0) (2024-03-08)


Expand Down
@@ -0,0 +1 @@
This patch brings the [fix](https://github.com/aws/aws-cdk/issues/29420) into the regression suite.
@@ -0,0 +1,4 @@
# Skipping the test to fix issue https://github.com/aws/aws-cdk/issues/29420.
# cli-integ tests failing for the old tests with the new cli changes for list stacks.

cdk ls --show-dependencies --json
Expand Up @@ -886,10 +886,10 @@ integTest('cdk ls --show-dependencies --json', withDefaultFixture(async (fixture
id: 'list-stacks',
dependencies: [
{
id: 'liststacksDependentStack',
id: 'list-stacks/DependentStack',
dependencies: [
{
id: 'liststacksDependentStackInnerDependentStack',
id: 'list-stacks/DependentStack/InnerDependentStack',
dependencies: [],
},
],
Expand All @@ -900,11 +900,11 @@ integTest('cdk ls --show-dependencies --json', withDefaultFixture(async (fixture
id: 'list-multiple-dependent-stacks',
dependencies: [
{
id: 'listmultipledependentstacksDependentStack1',
id: 'list-multiple-dependent-stacks/DependentStack1',
dependencies: [],
},
{
id: 'listmultipledependentstacksDependentStack2',
id: 'list-multiple-dependent-stacks/DependentStack2',
dependencies: [],
},
],
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-cdk/lib/list-stacks.ts
Expand Up @@ -56,7 +56,7 @@ export async function listStacks(toolkit: CdkToolkit, options: ListStacksOptions

for (const stack of collectionOfStacks.stackArtifacts) {
const data: StackDetails = {
id: stack.id,
id: stack.displayName ?? stack.id,
name: stack.stackName,
environment: stack.environment,
dependencies: [],
Expand All @@ -82,7 +82,7 @@ export async function listStacks(toolkit: CdkToolkit, options: ListStacksOptions
}
} else {
data.dependencies.push({
id: depStack.stackArtifacts[0].id,
id: depStack.stackArtifacts[0].displayName ?? depStack.stackArtifacts[0].id,
dependencies: [],
});
}
Expand Down
92 changes: 90 additions & 2 deletions packages/aws-cdk/test/list-stacks.test.ts
Expand Up @@ -171,7 +171,7 @@ describe('list', () => {
dependencies: [],
},
{
id: 'Test-Stack-B',
id: 'Test-Stack-A/Test-Stack-B',
name: 'Test-Stack-B',
environment: {
account: '123456789012',
Expand All @@ -185,7 +185,7 @@ describe('list', () => {
}]));
});

test('stacks with nested dependencies', async () => {
test('stacks with display names and have nested dependencies', async () => {
let cloudExecutable = new MockCloudExecutable({
stacks: [
MockStack.MOCK_STACK_A,
Expand All @@ -201,9 +201,84 @@ describe('list', () => {
],
},
depends: ['Test-Stack-A'],
displayName: 'Test-Stack-A/Test-Stack-B',
},
{
stackName: 'Test-Stack-C',
template: { Resources: { TemplateName: 'Test-Stack-C' } },
env: 'aws://123456789012/bermuda-triangle-1',
metadata: {
'/Test-Stack-C': [
{
type: cxschema.ArtifactMetadataEntryType.STACK_TAGS,
},
],
},
depends: ['Test-Stack-B'],
displayName: 'Test-Stack-A/Test-Stack-B/Test-Stack-C',
},
],
});

// GIVEN
const toolkit = new CdkToolkit({
cloudExecutable,
configuration: cloudExecutable.configuration,
sdkProvider: cloudExecutable.sdkProvider,
deployments: cloudFormation,
});

// WHEN
const workflow = await listStacks( toolkit, { selectors: ['Test-Stack-A', 'Test-Stack-A/Test-Stack-B', 'Test-Stack-A/Test-Stack-B/Test-Stack-C'] });

// THEN
expect(JSON.stringify(workflow)).toEqual(JSON.stringify([{
id: 'Test-Stack-A',
name: 'Test-Stack-A',
environment: {
account: '123456789012',
region: 'bermuda-triangle-1',
name: 'aws://123456789012/bermuda-triangle-1',
},
dependencies: [],
},
{
id: 'Test-Stack-A/Test-Stack-B',
name: 'Test-Stack-B',
environment: {
account: '123456789012',
region: 'bermuda-triangle-1',
name: 'aws://123456789012/bermuda-triangle-1',
},
dependencies: [{
id: 'Test-Stack-A',
dependencies: [],
}],
},
{
id: 'Test-Stack-A/Test-Stack-B/Test-Stack-C',
name: 'Test-Stack-C',
environment: {
account: '123456789012',
region: 'bermuda-triangle-1',
name: 'aws://123456789012/bermuda-triangle-1',
},
dependencies: [{
id: 'Test-Stack-A/Test-Stack-B',
dependencies: [{
id: 'Test-Stack-A',
dependencies: [],
}],
}],
}]));
});

test('stacks with nested dependencies', async () => {
let cloudExecutable = new MockCloudExecutable({
stacks: [
MockStack.MOCK_STACK_A,
{
stackName: 'Test-Stack-B',
template: { Resources: { TemplateName: 'Test-Stack-B' } },
env: 'aws://123456789012/bermuda-triangle-1',
metadata: {
Expand All @@ -213,6 +288,19 @@ describe('list', () => {
},
],
},
depends: ['Test-Stack-A'],
},
{
stackName: 'Test-Stack-C',
template: { Resources: { TemplateName: 'Test-Stack-C' } },
env: 'aws://123456789012/bermuda-triangle-1',
metadata: {
'/Test-Stack-C': [
{
type: cxschema.ArtifactMetadataEntryType.STACK_TAGS,
},
],
},
depends: ['Test-Stack-B'],
},
],
Expand Down
4 changes: 2 additions & 2 deletions version.v2.json
@@ -1,4 +1,4 @@
{
"version": "2.132.0",
"alphaVersion": "2.132.0-alpha.0"
"version": "2.132.1",
"alphaVersion": "2.132.1-alpha.0"
}

0 comments on commit 9df7dd3

Please sign in to comment.