Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate @aws-cdk-testing/cli-integ from sdk v2 to sdk v3 #30046

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

vinayak-kukreja
Copy link
Contributor

@vinayak-kukreja vinayak-kukreja commented May 2, 2024

Closes #29837

Reason for this change

We are migrating our code from SDK v2 to SDK v3. This change is part of that effort.

Description of changes

We used to have an abstracted caller since SDK v2 did not have separated clients. Since SDK v3 now have separated clients, I am also making code changes to reflect that and not moving forwards with the abstracted client vendor.

Also, updated the imports and references to work with SDK v3 and introduced ini for reading aws config files, since SDK v3 changed the functionality from sync to async and to add that to our code would mean a lot more of changes for adding a simple functionality

Description of how you validated changes

The run through test pipeline is successful.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
@github-actions github-actions bot added the p2 label May 2, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team May 2, 2024 16:56
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label May 2, 2024
Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
"@aws-sdk/client-cloudformation": "3.421.0",
"@aws-sdk/client-s3": "3.421.0",
"@aws-sdk/client-ecr": "3.421.0",
"@aws-sdk/client-ecs": "3.451.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really weird. If we mention 3.421.0 it leads to test errors in packages/@aws-cdk/custom-resource-handlers/test/aws-events-targets/aws-api-handler/aws-api-handler.test.ts. Unfortunately, we had set the client version to 3.451.0 in there.

I see there is a lot of mismatch between sdk versions in different package.jsons and we need to align them to same version. We cannot lower them to a previous version, so probably will end up aligning to the version that is the highest in our package.

@vinayak-kukreja
Copy link
Contributor Author

I see some integ tests not running since they are unable to find credentials:

  ● update to stack in ROLLBACK_COMPLETE state will delete stack and create a new one
    Profile 'long-running-profile' does not exist in config file (/root/.aws/config)
      at chainableCredentials (../../lib/aws.ts:231:13)
      at new chainableCredentials (../../lib/aws.ts:39:20)
      at Function.forRegion (../../lib/aws.ts:21:12)
      at forRegion (../../lib/with-aws.ts:18:34)
      at ResourcePool.block (../../lib/resource-pool.ts:72:20)
      at ../../lib/integ-test.ts:51:14

This is due to a different path for config defined in delivlib here. Taking a look into how this binds with our test infrastructure.

Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
Signed-off-by: Vinayak Kukreja <vinakuk@amazon.com>
@vinayak-kukreja vinayak-kukreja marked this pull request as ready for review May 14, 2024 20:34
@vinayak-kukreja vinayak-kukreja changed the title chore: migrate @aws-cdk-testing/cli-integ from sdk v2 to sdk v3 chore: migrate @aws-cdk-testing/cli-integ from sdk v2 to sdk v3 May 14, 2024
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label May 14, 2024
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 7f7b528
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

➡️ PR build request submitted to test-main-pipeline ⬅️

A maintainer must now check the pipeline and add the pr-linter/cli-integ-tested label once the pipeline succeeds.

await this.aws.deleteStacks(...stacksToDelete.map(s => s.StackName));
await this.aws.deleteStacks(...stacksToDelete.map(s => {
if (!s.StackName) {
throw new Error('Stack name is required to delete a stack.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we be throwing an error here? I don't see that we did this before... I'm wondering if throwing here would cause resources to leak in the case that this error is thrown?

Comment on lines +324 to +326
if (!role.Role) {
throw new Error('Role not found');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment as my above comment. Why add the behavior of throwing error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. p2 pr/needs-maintainer-review This PR needs a review from a Core Team Member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SDKv3-05: Update @aws-cdk-testing/cli-integ
4 participants