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

[aws-codebuild] Provide the ability to explicitly set BuildEnvironment type #9817

Closed
jimistry123 opened this issue Aug 19, 2020 · 2 comments · Fixed by #19052
Closed

[aws-codebuild] Provide the ability to explicitly set BuildEnvironment type #9817

jimistry123 opened this issue Aug 19, 2020 · 2 comments · Fixed by #19052
Labels
@aws-cdk/aws-codebuild Related to AWS CodeBuild effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1

Comments

@jimistry123
Copy link

When building artifacts using ARM architecture, it would be nice to be able to specify the type of the build environment when CodeBuild is not able to directly infer the architecture from the build image. Especially this is the case when using a custom image instead of a default image.

Use Case

I am using a custom Docker image that is built from base ARM image LinuxBuildImage.AMAZON_LINUX_2_ARM. And when I create a CodeBuild project using this custom image, it configures the Environment.Type property to LINUX_CONTAINER instead of ARM_CONTAINER.

Proposed Solution

To workaround this issue, I have to use an escape hatch to modify CloudFormation resource behind CodeBuildProject like this:

CfnProject cfnProject = (CfnProject) createBuildProject().getNode().getDefaultChild();
if (cfnProject != null) {
  cfnProject.addPropertyOverride("Environment.Type", "ARM_CONTAINER");
}

So it would be nice if there was a type method in BuildEnvironment.Builder class that allows setting the type to LINUX_CONTAINER or ARM_CONTAINER.


This is a 🚀 Feature Request

@jimistry123 jimistry123 added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Aug 19, 2020
@github-actions github-actions bot added the @aws-cdk/aws-codebuild Related to AWS CodeBuild label Aug 19, 2020
@skinny85 skinny85 added effort/small Small work item – less than a day of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Aug 19, 2020
@skinny85
Copy link
Contributor

Hey @jimistry123 ,

thanks for opening the issue. We had a similar problem recently when CodeBuild introduced a second type of Windows build images. We solved it by adding a new enum that allows you to choose between the two versions - see #9526 for details.

Would you consider opening a similar PR for ARM images?

Thanks,
Adam

@mergify mergify bot closed this as completed in #19052 Mar 7, 2022
mergify bot pushed a commit that referenced this issue Mar 7, 2022
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:
- 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*
@github-actions
Copy link

github-actions bot commented Mar 7, 2022

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

TheRealAmazonKendra pushed a commit to TheRealAmazonKendra/aws-cdk that referenced this issue Mar 11, 2022
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*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codebuild Related to AWS CodeBuild effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants