aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.49k stars 3.84k forks source link

codebuild: ARM images supports all compute types, incorrect validation #30869

Closed Samrose-Ahmed closed 1 week ago

Samrose-Ahmed commented 1 month ago

Describe the bug

Theres is an incorrect validation here: https://github.com/aws/aws-cdk/blob/9bd92da62d8c4594a11f4ab078f07b8c20762329/packages/aws-cdk-lib/aws-codebuild/lib/linux-arm-build-image.ts#L115 that results in error like ARM images only support ComputeTypes 'BUILD_GENERAL1_SMALL' and 'BUILD_GENERAL1_LARGE' - 'BUILD_GENERAL1_XLARGE' was given at PipelineProject.renderEnvironment.

ARM images support all compute types, this is probably outdated.

Expected Behavior

Should support all compute types.

Current Behavior

Only supports small and large.

Reproduction Steps

create codebuild arm project with compute type XLARGE

Possible Solution

Just remove this code:

https://github.com/aws/aws-cdk/blob/9bd92da62d8c4594a11f4ab078f07b8c20762329/packages/aws-cdk-lib/aws-codebuild/lib/linux-arm-build-image.ts#L112-L116

Additional Information/Context

No response

CDK CLI Version

2.149.0 (build c8e5924)

Framework Version

No response

Node.js Version

18

OS

macos

Language

TypeScript

Language Version

No response

Other information

No response

scanlonp commented 1 month ago

Looks like as of last week ARM expanded to medium Xlarge and 2Xlarge compute types! See the table here.

We should remove the validation, thanks for the call out @Samrose-Ahmed!

Side note: it looks like reserved capacity fleets still have ARM compute types limited to small and large. Best to remove this validation to enable use, but something to keep in mind.

PeterEckIII commented 1 month ago

I'd like to work on this issue.

I've removed the code from the "Possible Solution" step. I've also removed the comment above it, suggesting the computeType must be ComputeType.SMALL or ComputeType.LARGE.

How should I be handling the TS warning now that the buildEnvironment variable is no longer being utilized in the validate method?

scanlonp commented 1 month ago

@PeterEckIII, looks like that validate function is specific to ARM build images. Since there are now no restrictions on ARM compute types, the validation may not be necessary at all.

PeterEckIII commented 1 month ago

Thanks @scanlonp, just created https://github.com/aws/aws-cdk/pull/30879 for this. Please let me know of any feedback.

PeterEckIII commented 1 month ago

@scanlonp, I amended my commit with some changes to test files, but it's still denying my PR due to no integration files being changed. I'm looking for any potentially affected files but am slow moving at the moment. If you know any integration files off the top of your head that I can adjust I will make that change. Otherwise, I'll keep digging. Thanks

github-actions[bot] commented 1 week ago

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

github-actions[bot] commented 1 week ago

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.