-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat(codebuild): add ec2 image types #34365
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
base: main
Are you sure you want to change the base?
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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 your contribution, I left a couple of questions.
@@ -46,6 +62,13 @@ export class LinuxArmBuildImage implements IBuildImage { | |||
/** Image "aws/codebuild/amazonlinux-aarch64-standard:3.0" based on Amazon Linux 2023. */ | |||
public static readonly AMAZON_LINUX_2023_STANDARD_3_0 = LinuxArmBuildImage.fromCodeBuildImageId('aws/codebuild/amazonlinux-aarch64-standard:3.0'); | |||
|
|||
/** The Amazon Linux arm 1.0 AMI, based on Amazon Linux 2023. */ | |||
public static readonly AMAZON_LINUX_2023_AMI: IBuildImage = new LinuxArmBuildImage({ | |||
imageId: 'aws/codebuild/ami/amazonlinux-arm-base:latest', |
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.
Could you help me figure out why :latest
is a safe choice?
Information I found is a bit confusing in that regard:
aws codebuild list-curated-environment-images \
--query 'platforms[].languages[].images[].[name,description] | [?starts_with(@[0], `aws/codebuild/ami/amazonlinux-arm-base`)]'
output is:
[
[
"aws/codebuild/ami/amazonlinux-arm-base:2023-1.0",
"AWS CodeBuild Reserved Capacity AMI based on Amazon Linux 2023 AMI built by Amazon Web Services (arm64)"
],
[
"aws/codebuild/ami/amazonlinux-arm-base:latest",
"AWS CodeBuild On-Demand AMI based on Amazon Linux AMI built by Amazon Web Services (arm64)"
]
]
I guess we want to use the On-Demand
one even if there is no mention about Amazon Linux 2023
? (which might just be a miss in the description).
public static readonly AMAZON_LINUX_2023_AMI: IBuildImage = new LinuxArmBuildImage({ | ||
imageId: 'aws/codebuild/ami/amazonlinux-arm-base:latest', | ||
imagePullPrincipalType: ImagePullPrincipalType.CODEBUILD, | ||
imageType: LinuxArmImageType.ARM_EC2, |
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.
My understanding is that AMI-based
image are meant to be used with EC2
, based on this link
An Amazon Machine Image (AMI) is the basic unit of deployment in Amazon EC2, and is one of the types of images you can create with Image Builder. An AMI is a pre-configured virtual machine image that contains the operating system (OS) and preinstalled software to deploy EC2 instances.
Which makes me wonder if we shouldn't add another static method helper like:
public static fromCodeBuildAmiImageId(id: string): IBuildImage {
return new LinuxArmBuildImage({
imageId: id,
imagePullPrincipalType: ImagePullPrincipalType.CODEBUILD,
imageType: LinuxArmImageType.ARM_EC2,
});
}
Issue # (if applicable)
Closes #32978.
Reason for this change
The CodeBuild CDK code needs to add new image types to match newly supported environment types:
LINUX_EC2
,ARM_EC2
andWINDOWS_EC2
.These three imageId values were used because they are the only ones supported when launching EC2-based CodeBuild environments through both CloudFormation and the AWS API. Other image IDs resulted in errors or were not accepted for the LINUX_EC2, WINDOWS_EC2 and ARM_EC2 environment types.
aws/codebuild/ami/amazonlinux-x86_64-base:latest
aws/codebuild/ami/amazonlinux-arm-base:latest
aws/codebuild/ami/windows-base:2022
Description of changes
Add new image types
LINUX_EC2
,ARM_EC2
andWINDOWS_EC2
into file.Description of how you validated changes
I created unit tests and integration tests.
Both were successful.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license