-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat(codebuild): improved support for ARM build images #19052
Conversation
…y supported by CDK by: - renaming the previously hidden class ArmBuildImage to LinuxArmBuildImage (in case there are Windows ARM Build Images in the future). - exporting LinuxArmBuildImage so it can be used. - adding the two ARM constants present in LinuxBuildImage also to LinuxArmBuildImage. - adding the method fromEcrRepository to support custom ARM build images. - making the LinuxArmBuildImage more akin to the LinuxBuildImage and WindowsBuildImage (built with props instead of just image name). - updating documentation to show examples of ARM and highlighting the LinuxBuildImage is for x86-64.
@codemeddler any chance of adding a few unit tests? 🙂 |
Sure if you can point me where to add them and which ones you want. I saw the GPU ones had their own file, the codebuild.test has ARM image testing in it, and only one for the fromEcrRepository is in integ.ecr.lit. |
Let's create a new file, |
@skinny85 Does it matter which values are used for the image repositories in the tests? I can see the public ECR registry has many foobar repositories, and not sure which one the GPU one points to, or if it matters what it points to. |
The tests should use the constants defined in the new class. If you're asking about testing the |
…y supported by CDK by: - renaming the previously hidden class ArmBuildImage to LinuxArmBuildImage (in case there are Windows ARM Build Images in the future). - exporting LinuxArmBuildImage so it can be used. - adding the two ARM constants present in LinuxBuildImage also to LinuxArmBuildImage. - adding the method fromEcrRepository to support custom ARM build images. - making the LinuxArmBuildImage more akin to the LinuxBuildImage and WindowsBuildImage (built with props instead of just image name). - updating documentation to show examples of ARM and highlighting the LinuxBuildImage is for x86-64.
…ce it is an exact copy from existing tests)
/** Image "aws/codebuild/amazonlinux2-aarch64-standard:2.0". */ | ||
public static readonly AMAZON_LINUX_2_ARM_2 = LinuxArmBuildImage.codeBuildImage('aws/codebuild/amazonlinux2-aarch64-standard:2.0'); | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skinny85 Any idea why the linter complains about @aws-cdk/aws-codebuild: error: [awslint:docs-public-apis:@aws-cdk/aws-codebuild.LinuxArmBuildImage.fromEcrRepository] Public API element must have a docstring?
If I'm not mistaken this should be it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try putting the @returns
at the end (where it should be, honestly 😛).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just copied what was already there in the file 🤷♂️. Seems to have fixed it though.
@skinny85 Passes tests but build fails with something that seems unrelated:
Want further actions from me or can this PR be considered ready? |
Try upgrading with the latest |
@skinny85 That seems to have fixed that. Seems only validate-pr is missing any more. Not sure what that is? Btw. I did a generic search for ARM in the GitHub issues and found ticket #9817, which I think is related. I probably did too specific of a search initially (or might have used aarch instead of ARM) so missed that one when creating my issue. I think this PR would solve that other ticket as well, though a bit differently (they were expecting a similar architecture setting / switching as I did). |
Yes, let's add #9817 to the list of issued fixed by this PR 🙂. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @codemeddler! Just a few minor notes on the code organization.
packages/@aws-cdk/aws-codebuild/test/linux-arm-build-image.test.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/aws-codebuild/test/linux-arm-build-image.test.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/aws-codebuild/test/linux-arm-build-image.test.ts
Outdated
Show resolved
Hide resolved
…circular dependency after all.
…es. Instead of importing the whole codebuild project, import only the needed bits to linux-arm-build-image.test.ts.
…ArmBuildImage and back up on Project. Might actually still be due to the test includes, but guess that is the next go.
… and make sure the imports are sensible.
… Will wait for discussions before proceeding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all your efforts on this @codemeddler! One last question.
packages/@aws-cdk/aws-codebuild/test/linux-arm-build-image.test.ts
Outdated
Show resolved
Hide resolved
# Conflicts: # packages/@aws-cdk/aws-codebuild/test/linux-arm-build-image.test.ts
Build was successful with the last discussion points as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @codemeddler!
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Fixes aws#18916 Fixes aws#9817 ### Motivation CDK currently has poor and hidden support for using ARM build images for CodeBuild that do not match what you can do with the Console. Currently, CDK has under LinuxBuildImage two constants not mentioned in the documentation. The constants internally map to a hidden ArmBuildImage class, which provides support for the standard CodeBuild ARM build images. That is the extent of the support, making ARM a second class citizen compared to x86-64 Linux and Windows build images as, for example, you can't use custom aarch64 ECR images. ### Changes This pull request addresses the missing support by: - renaming the previously hidden class ArmBuildImage to LinuxArmBuildImage (in case there are Windows ARM Build Images in the future). - exporting LinuxArmBuildImage so it can be used. - adding the two ARM constants present in LinuxBuildImage also to LinuxArmBuildImage. The constants are also left under LinuxBuildImage to not break backwards compatibility. - adding the method fromEcrRepository() to support custom ARM build images. - making the LinuxArmBuildImage closer to the LinuxBuildImage and WindowsBuildImage (built with props instead of just image name). - updating documentation to show examples of ARM and highlighting the LinuxBuildImage is for x86-64. ### Testing The unit test for ARM image is still valid. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Fixes #18916
Fixes #9817
Motivation
CDK currently has poor and hidden support for using ARM build images for CodeBuild that do not match what you can do with the Console. Currently, CDK has under LinuxBuildImage two constants not mentioned in the documentation. The constants internally map to a hidden ArmBuildImage class, which provides support for the standard CodeBuild ARM build images. That is the extent of the support, making ARM a second class citizen compared to x86-64 Linux and Windows build images as, for example, you can't use custom aarch64 ECR images.
Changes
This pull request addresses the missing support by:
Testing
The unit test for ARM image is still valid.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license