Skip to content

Commit 5bc0662

Browse files
TheRealAmazonKendraotaviomacedorix0rrr
authored
feat(cli): upgrade aws-sdk to sdkv3 (#31702)
This PR updates the CDK CLI to use the AWS SDK V3 instead of V2. ### Manual Test Cases for Authorization All tests were run verbosely so that I could manually check the credentials being used from the CLI output. - [x] No credentials setup and no default profile fails as expected (established to ensure nothing was unintentionally setup) - [x] Explicitly provided profile sourced from config file, tested with both `--profile` and `AWS_PROFILE` - [x] `aws_access_key_id` and `aws_secret_access_key` - [x] `aws_access_key_id` and `aws_secret_access_key` and `region` - [x] `source_profile` and `role_arn` that points to another profile with `aws_access_key_id` and `aws_secret_access_key` in both config and credentials - [x] `source_profile` and `role_arn` that points to Environment - [x] `source_profile` that and `role_arn` that points to SSO profile in both config and credentials - [x] SSO both using all fields in `[profile]` and split between `[sso-session]` and `[profile]` - [x] `credential_source` is Environment - [x] `credential_process` - [x] Explicitly provided profile sourced from credentials file - [x] `aws_access_key_id` and `aws_secret_access_key` - [x] `aws_access_key_id` and `aws_secret_access_key` and `region` - [x] `source_profile` and `role_arn` that points to another profile with `aws_access_key_id` and `aws_secret_access_key` in both config and credentials - [x] `source_profile` and `role_arn` that points to Environment - [x] `source_profile` that and `role_arn` that points to SSO profile in both config and credentials - [x] `credential_source` is Environment - [x] `credential_source` is EcsContainer (integ tests in CodeBuild) - [x] `credential_process` - [x] Default profile (in both config file and credentials file) - [x] `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables set (cleared after test) - [x] `AMAZON_ACCESS_KEY_ID` and `AMAZON_SECRET_ACCESS_KEY` environment variables set (cleared after test) - [x] `aws_access_key_id` and `aws_secret_access_key` - [x] `aws_access_key_id` and `aws_secret_access_key` and `region` - [x] `source_profile` and `role_arn` that points to a profile with `aws_access_key_id` and `aws_secret_access_key` - [x] `source_profile` and `role_arn` that points to Environment (this will use `fromEnv` prior to getting to looking for `source_profile` in the Ini file) - [x] SSO profile is setup as default - [x] `credential_process` Closes #25870, #26292, #20956, #24744, #27265, 20896. ### Reason for this change The AWS SDK V2 is now in maintenance mode. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --------- Co-authored-by: Otavio Macedo <[email protected]> Co-authored-by: Rico Huijbers <[email protected]>
1 parent 6303b72 commit 5bc0662

File tree

525 files changed

+191999
-98902
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

525 files changed

+191999
-98902
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The output of this test is changed by the sdk upgrade. The type and content of the error have changed from sdkv2 to sdkv3. We now receive more specific information about the error type.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Skipping test due to the incompatibility in error output between sdkv2 and sdkv3
2+
hotswap deployment for ecs service detects failed deployment and errors

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

+15-8
Original file line numberDiff line numberDiff line change
@@ -2160,11 +2160,12 @@ integTest(
21602160
const functionName = response.Stacks?.[0].Outputs?.[0].OutputValue;
21612161

21622162
// THEN
2163-
21642163
// The deployment should not trigger a full deployment, thus the stack's status must remains
21652164
// "CREATE_COMPLETE"
21662165
expect(response.Stacks?.[0].StackStatus).toEqual('CREATE_COMPLETE');
2167-
expect(deployOutput).toContain(`Lambda Function '${functionName}' hotswapped!`);
2166+
// The entire string fails locally due to formatting. Making this test less specific
2167+
expect(deployOutput).toMatch(/hotswapped!/);
2168+
expect(deployOutput).toContain(functionName);
21682169
}),
21692170
);
21702171

@@ -2205,7 +2206,9 @@ integTest(
22052206
// The deployment should not trigger a full deployment, thus the stack's status must remains
22062207
// "CREATE_COMPLETE"
22072208
expect(response.Stacks?.[0].StackStatus).toEqual('CREATE_COMPLETE');
2208-
expect(deployOutput).toContain(`Lambda Function '${functionName}' hotswapped!`);
2209+
// The entire string fails locally due to formatting. Making this test less specific
2210+
expect(deployOutput).toMatch(/hotswapped!/);
2211+
expect(deployOutput).toContain(functionName);
22092212
} finally {
22102213
// Ensure cleanup in reverse order due to use of import/export
22112214
await fixture.cdkDestroy('lambda-hotswap');
@@ -2244,7 +2247,9 @@ integTest(
22442247
// The deployment should not trigger a full deployment, thus the stack's status must remains
22452248
// "CREATE_COMPLETE"
22462249
expect(response.Stacks?.[0].StackStatus).toEqual('CREATE_COMPLETE');
2247-
expect(deployOutput).toContain(`ECS Service '${serviceName}' hotswapped!`);
2250+
// The entire string fails locally due to formatting. Making this test less specific
2251+
expect(deployOutput).toMatch(/hotswapped!/);
2252+
expect(deployOutput).toContain(serviceName);
22482253
}),
22492254
);
22502255

@@ -2257,7 +2262,7 @@ integTest(
22572262
});
22582263

22592264
// WHEN
2260-
await fixture.cdkDeploy('ecs-hotswap', {
2265+
const deployOutput = await fixture.cdkDeploy('ecs-hotswap', {
22612266
options: ['--hotswap'],
22622267
modEnv: {
22632268
DYNAMIC_ECS_PROPERTY_VALUE: 'new value',
@@ -2283,14 +2288,15 @@ integTest(
22832288
}),
22842289
);
22852290
expect(describeServicesResponse.services?.[0].deployments).toHaveLength(1); // only one deployment present
2291+
expect(deployOutput).toMatch(/hotswapped!/);
22862292
}),
22872293
);
22882294

22892295
integTest(
22902296
'hotswap deployment for ecs service detects failed deployment and errors',
22912297
withExtendedTimeoutFixture(async (fixture) => {
22922298
// GIVEN
2293-
await fixture.cdkDeploy('ecs-hotswap');
2299+
await fixture.cdkDeploy('ecs-hotswap', { verbose: true });
22942300

22952301
// WHEN
22962302
const deployOutput = await fixture.cdkDeploy('ecs-hotswap', {
@@ -2299,10 +2305,11 @@ integTest(
22992305
USE_INVALID_ECS_HOTSWAP_IMAGE: 'true',
23002306
},
23012307
allowErrExit: true,
2308+
verbose: true,
23022309
});
23032310

2304-
const expectedSubstring = 'Resource is not in the state deploymentCompleted';
2305-
2311+
// THEN
2312+
const expectedSubstring = 'Resource is not in the expected state due to waiter status: TIMEOUT';
23062313
expect(deployOutput).toContain(expectedSubstring);
23072314
expect(deployOutput).not.toContain('hotswapped!');
23082315
}),

packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/PnpmTestDefaultTestDeployAssert397EDF83.assets.json

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/PnpmTestDefaultTestDeployAssert397EDF83.template.json

+17-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/TestStack.assets.json

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/TestStack.template.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"S3Bucket": {
3939
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
4040
},
41-
"S3Key": "79d996cbc4399f346983e7812dac92ec3a24a0f1ffb793b5b0acea8c43d33332.zip"
41+
"S3Key": "090e0296140a1dcbecf4e3e94b65780102aefb7e81e4247b1f00a7cc9e8e98c5.zip"
4242
},
4343
"Handler": "index.handler",
4444
"Role": {

packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.2ec513a38a5e0360cbeb87596a68f7e0e62bb29c60bfe299a7bf85d3ec4eafcf/.pnpm-store/v3/files/0d/d5ff6301797b8d4e93e008f351c8f1fe7fe54b28c42553f46298651233a4bc5bf13c33e19c0f3d7fa340cc0c84d43d6f9fb30c479f73e75cbd0a0f586359de

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.2ec513a38a5e0360cbeb87596a68f7e0e62bb29c60bfe299a7bf85d3ec4eafcf/.pnpm-store/v3/files/0f/ece439109b03d7f5b5d5912b445a091dc63efe7470cc5caf3e17f24e4b4d2503d43930e3b98a24465036e9c8b514e45b082d6944a8d515454481bd65788562-index.json

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)