Skip to content

Commit

Permalink
Merge branch 'main' into huijbers/cdklabs-eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Oct 7, 2024
2 parents 14e2e44 + a8b2f01 commit 73ac5a8
Show file tree
Hide file tree
Showing 77 changed files with 26,449 additions and 24,009 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/request-cli-integ-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
persist-credentials: false
- name: Find changed cli files
id: changed-cli-files
uses: tj-actions/changed-files@48d8f15b2aaa3d255ca5af3eba4870f807ce6b3c
uses: tj-actions/changed-files@c3a1bb2c992d77180ae65be6ae6c166cf40f857c
with:
base_sha: ${{ github.event.pull_request.base.sha }}
files_yaml: |
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.v2.alpha.md
Original file line number Diff line number Diff line change
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.161.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.161.0-alpha.0...v2.161.1-alpha.0) (2024-10-05)

## [2.161.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.160.0-alpha.0...v2.161.0-alpha.0) (2024-10-03)


Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.v2.md
Original file line number Diff line number Diff line change
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.161.1](https://github.com/aws/aws-cdk/compare/v2.161.0...v2.161.1) (2024-10-05)


### Reverts

* feat(cli): cdk rollback ([#31407](https://github.com/aws/aws-cdk/issues/31407)) ([#31657](https://github.com/aws/aws-cdk/issues/31657)) ([29bf223](https://github.com/aws/aws-cdk/commit/29bf2233a33d3ded20639279fa712a5b036fe041))

## [2.161.0](https://github.com/aws/aws-cdk/compare/v2.160.0...v2.161.0) (2024-10-03)


Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"colors": "1.4.0",
"markdown-it": "^12.3.2",
"string-width": "^4.2.3",
"@types/babel__traverse": "7.18.2"
"@types/babel__traverse": "7.18.2",
"@smithy/types": "3.5.0"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions packages/@aws-cdk-testing/cli-integ/lib/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
DeleteStackCommand,
DescribeStacksCommand,
UpdateTerminationProtectionCommand,
Stack,
type Stack,
} from '@aws-sdk/client-cloudformation';
import { DeleteRepositoryCommand, ECRClient } from '@aws-sdk/client-ecr';
import { ECSClient } from '@aws-sdk/client-ecs';
Expand All @@ -13,14 +13,14 @@ import {
S3Client,
DeleteObjectsCommand,
ListObjectVersionsCommand,
ObjectIdentifier,
type ObjectIdentifier,
DeleteBucketCommand,
} from '@aws-sdk/client-s3';
import { SNSClient } from '@aws-sdk/client-sns';
import { SSOClient } from '@aws-sdk/client-sso';
import { STSClient, GetCallerIdentityCommand } from '@aws-sdk/client-sts';
import { fromIni } from '@aws-sdk/credential-providers';
import { AwsCredentialIdentityProvider } from '@smithy/types';
import type { AwsCredentialIdentityProvider } from '@smithy/types';
import { ConfiguredRetryStrategy } from '@smithy/util-retry';
interface ClientConfig {
readonly credentials?: AwsCredentialIdentityProvider;
Expand Down Expand Up @@ -75,7 +75,7 @@ export class AwsClients {
maxAttempts: 2,
});

return (await stsClient.send(new GetCallerIdentityCommand())).Account!;
return (await stsClient.send(new GetCallerIdentityCommand({}))).Account!;
}

public async deleteStacks(...stackNames: string[]) {
Expand Down
7 changes: 6 additions & 1 deletion packages/@aws-cdk-testing/cli-integ/lib/with-cdk-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ interface CommonCdkBootstrapCommandOptions {
* @default - none
*/
readonly tags?: string;

/**
* @default - the default CDK qualifier
*/
readonly qualifier?: string;
}

export interface CdkLegacyBootstrapCommandOptions extends CommonCdkBootstrapCommandOptions {
Expand Down Expand Up @@ -423,7 +428,7 @@ export class TestFixture extends ShellHelper {
if (options.bootstrapBucketName) {
args.push('--bootstrap-bucket-name', options.bootstrapBucketName);
}
args.push('--qualifier', this.qualifier);
args.push('--qualifier', options.qualifier ?? this.qualifier);
if (options.cfnExecutionPolicy) {
args.push('--cloudformation-execution-policies', options.cfnExecutionPolicy);
}
Expand Down
26 changes: 13 additions & 13 deletions packages/@aws-cdk-testing/cli-integ/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@
},
"dependencies": {
"@octokit/rest": "^18.12.0",
"@aws-sdk/client-codeartifact": "3.637.0",
"@aws-sdk/client-cloudformation": "3.637.0",
"@aws-sdk/client-ecr": "3.637.0",
"@aws-sdk/client-ecs": "3.637.0",
"@aws-sdk/client-iam": "3.637.0",
"@aws-sdk/client-lambda": "3.637.0",
"@aws-sdk/client-s3": "3.637.0",
"@aws-sdk/client-sns": "3.637.0",
"@aws-sdk/client-sso": "3.637.0",
"@aws-sdk/client-sts": "3.637.0",
"@aws-sdk/credential-providers": "3.637.0",
"@smithy/util-retry": "3.0.4",
"@smithy/types": "3.4.0",
"@aws-sdk/client-codeartifact": "3.632.0",
"@aws-sdk/client-cloudformation": "3.632.0",
"@aws-sdk/client-ecr": "3.632.0",
"@aws-sdk/client-ecs": "3.632.0",
"@aws-sdk/client-iam": "3.632.0",
"@aws-sdk/client-lambda": "3.632.0",
"@aws-sdk/client-s3": "3.632.0",
"@aws-sdk/client-sns": "3.632.0",
"@aws-sdk/client-sso": "3.632.0",
"@aws-sdk/client-sts": "3.632.0",
"@aws-sdk/credential-providers": "3.632.0",
"@smithy/util-retry": "3.0.7",
"@smithy/types": "3.5.0",
"axios": "^1.7.7",
"chalk": "^4",
"fs-extra": "^9.1.0",
Expand Down
20 changes: 15 additions & 5 deletions packages/@aws-cdk-testing/cli-integ/resources/cdk-apps/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if (process.env.PACKAGE_LAYOUT_VERSION === '1') {
}

const { Annotations } = cdk;
const { StackWithNestedStack, StackWithNestedStackUsingParameters } = require('./nested-stack');
const { StackWithNestedStack, StackWithDoublyNestedStack, StackWithNestedStackUsingParameters } = require('./nested-stack');

const stackPrefix = process.env.STACK_NAME_PREFIX;
if (!stackPrefix) {
Expand Down Expand Up @@ -176,7 +176,7 @@ class DependentStack extends Stack {
super(scope, id);

const innerDependentStack = new InnerDependentStack(this, 'InnerDependentStack');

this.addDependency(innerDependentStack);
}
}
Expand Down Expand Up @@ -204,7 +204,7 @@ class MigrateStack extends cdk.Stack {
new cdk.CfnOutput(this, 'QueueUrl', {
value: queue.queueUrl,
});

new cdk.CfnOutput(this, 'QueueLogicalId', {
value: queue.node.defaultChild.logicalId,
});
Expand Down Expand Up @@ -258,7 +258,7 @@ class ImportableStack extends cdk.Stack {
new cdk.CfnOutput(this, 'QueueUrl', {
value: queue.queueUrl,
});

new cdk.CfnOutput(this, 'QueueLogicalId', {
value: queue.node.defaultChild.logicalId,
});
Expand Down Expand Up @@ -438,9 +438,17 @@ class IamRolesStack extends cdk.Stack {
// Environment variabile is used to create a bunch of roles to test
// that large diff templates are uploaded to S3 to create the changeset.
for(let i = 1; i <= Number(process.env.NUMBER_OF_ROLES) ; i++) {
new iam.Role(this, `Role${i}`, {
const role = new iam.Role(this, `Role${i}`, {
assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'),
});
const cfnRole = role.node.defaultChild;

// For any extra IAM roles created, add a ton of metadata so that the template size is > 50 KiB.
if (i > 1) {
for(let i = 1; i <= 30 ; i++) {
cfnRole.addMetadata('a'.repeat(1000), 'v');
}
}
}
}
}
Expand Down Expand Up @@ -792,6 +800,7 @@ switch (stackSet) {

new LambdaStack(app, `${stackPrefix}-lambda`);

// This stack is used to test diff with large templates by creating a role with a ton of metadata
new IamRolesStack(app, `${stackPrefix}-iam-roles`);

if (process.env.ENABLE_VPC_TESTING == 'IMPORT') {
Expand Down Expand Up @@ -835,6 +844,7 @@ switch (stackSet) {

new StackWithNestedStack(app, `${stackPrefix}-with-nested-stack`);
new StackWithNestedStackUsingParameters(app, `${stackPrefix}-with-nested-stack-using-parameters`);
new StackWithDoublyNestedStack(app, `${stackPrefix}-with-doubly-nested-stack`);
new ListStack(app, `${stackPrefix}-list-stacks`)
new ListMultipleDependentStack(app, `${stackPrefix}-list-multiple-dependent-stacks`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ class MyNestedStack extends cfn.NestedStack {
}
}

class DoublyNestedStack extends cfn.NestedStack {
constructor(scope, id) {
super(scope, id);

new MyNestedStack(this, 'Nestor');
}
}

class StackWithDoublyNestedStack extends Stack {
constructor(scope, id) {
super(scope, id);
new DoublyNestedStack(this, 'DoubleDouble');
}
}

class StackWithNestedStackUsingParameters extends Stack {
constructor(scope, id) {
super(scope, id);
Expand All @@ -47,3 +62,4 @@ class MyNestedStackUsingParameters extends cfn.NestedStack {

exports.StackWithNestedStack = StackWithNestedStack;
exports.StackWithNestedStackUsingParameters = StackWithNestedStackUsingParameters;
exports.StackWithDoublyNestedStack = StackWithDoublyNestedStack;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This patch brings the [fix](https://github.com/aws/aws-cdk/issues/31654) into the regression suite.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Skipping the test to fix issue https://github.com/aws/aws-cdk/issues/31654.
# cli-integ tests failing for the old tests with the new cli changes for nested stacks.

test cdk rollback
test cdk rollback --force
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,13 @@ integTest(
}),
);

integTest('doubly nested stack',
withDefaultFixture(async (fixture) => {
await fixture.cdkDeploy('with-doubly-nested-stack', {
captureStderr: false,
});
}));

integTest(
'nested stack with parameters',
withDefaultFixture(async (fixture) => {
Expand Down Expand Up @@ -1035,18 +1042,18 @@ integTest(
integTest(
'cdk diff with large changeset does not fail',
withDefaultFixture(async (fixture) => {
// GIVEN - small initial stack with only ane IAM role
// GIVEN - small initial stack with only one IAM role
await fixture.cdkDeploy('iam-roles', {
modEnv: {
NUMBER_OF_ROLES: '1',
},
});

// WHEN - adding 200 roles to the same stack to create a large diff
// WHEN - adding an additional role with a ton of metadata to create a large diff
const diff = await fixture.cdk(['diff', fixture.fullStackName('iam-roles')], {
verbose: true,
modEnv: {
NUMBER_OF_ROLES: '200',
NUMBER_OF_ROLES: '2',
},
});

Expand All @@ -1056,6 +1063,40 @@ integTest(
}),
);

integTest('cdk diff with large changeset and custom toolkit stack name and qualifier does not fail', withoutBootstrap(async (fixture) => {
// Bootstrapping with custom toolkit stack name and qualifier
const qualifier = 'abc1111';
const toolkitStackName = 'custom-stack2';
await fixture.cdkBootstrapModern({
verbose: true,
toolkitStackName: toolkitStackName,
qualifier: qualifier,
});

// Deploying small initial stack with only one IAM role
await fixture.cdkDeploy('iam-roles', {
modEnv: {
NUMBER_OF_ROLES: '1',
},
options: [
'--toolkit-stack-name', toolkitStackName,
'--context', `@aws-cdk/core:bootstrapQualifier=${qualifier}`,
],
});

// WHEN - adding a role with a ton of metadata to create a large diff
const diff = await fixture.cdk(['diff', '--toolkit-stack-name', toolkitStackName, '--context', `@aws-cdk/core:bootstrapQualifier=${qualifier}`, fixture.fullStackName('iam-roles')], {
verbose: true,
modEnv: {
NUMBER_OF_ROLES: '2',
},
});

// Assert that the CLI assumes the file publishing role:
expect(diff).toMatch(/Assuming role .*file-publishing-role/);
expect(diff).toContain('success: Published');
}));

integTest(
'cdk diff --security-only successfully outputs sso-permission-set-without-managed-policy information',
withDefaultFixture(async (fixture) => {
Expand Down Expand Up @@ -2363,7 +2404,7 @@ integTest(
}),
);

integTest('cdk bootstrap notice is displayed correctly', withDefaultFixture(async (fixture) => {
integTest('cdk notices are displayed correctly', withDefaultFixture(async (fixture) => {

const cache = {
expiration: 4125963264000, // year 2100 so we never overwrite the cache
Expand Down
7 changes: 3 additions & 4 deletions packages/@aws-cdk-testing/framework-integ/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/integ-runner": "^0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@aws-sdk/client-acm": "3.421.0",
"@aws-sdk/client-rds": "3.421.0",
"@aws-sdk/client-s3": "3.421.0",
"@aws-sdk/client-acm": "3.632.0",
"@aws-sdk/client-rds": "3.632.0",
"@aws-sdk/client-s3": "3.632.0",
"delay": "5.0.0"
},
"dependencies": {
Expand All @@ -43,7 +43,6 @@
"@aws-cdk/lambda-layer-kubectl-v29": "^2.1.0",
"@aws-cdk/lambda-layer-kubectl-v30": "^2.0.1",
"aws-cdk-lib": "0.0.0",
"aws-sdk-mock": "5.6.0",
"cdk8s": "2.69.0",
"cdk8s-plus-27": "2.9.5",
"constructs": "^10.0.0"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 73ac5a8

Please sign in to comment.