Skip to content

Commit 0d187c1

Browse files
authored
feat(codebuild): add support for aws/codebuild/amazonlinux2-aarch64-standard:3.0 (#25351)
This fix adds support for `aws/codebuild/amazonlinux2-aarch64-standard:3.0` as added [here](https://github.com/aws/aws-codebuild-docker-images/releases/tag/23.04.25). Closes #25334. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent ad71026 commit 0d187c1

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

packages/aws-cdk-lib/aws-codebuild/lib/linux-arm-build-image.ts

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export class LinuxArmBuildImage implements IBuildImage {
3232
public static readonly AMAZON_LINUX_2_STANDARD_1_0 = LinuxArmBuildImage.fromCodeBuildImageId('aws/codebuild/amazonlinux2-aarch64-standard:1.0');
3333
/** Image "aws/codebuild/amazonlinux2-aarch64-standard:2.0". */
3434
public static readonly AMAZON_LINUX_2_STANDARD_2_0 = LinuxArmBuildImage.fromCodeBuildImageId('aws/codebuild/amazonlinux2-aarch64-standard:2.0');
35+
/** Image "aws/codebuild/amazonlinux2-aarch64-standard:3.0". */
36+
public static readonly AMAZON_LINUX_2_STANDARD_3_0 = LinuxArmBuildImage.fromCodeBuildImageId('aws/codebuild/amazonlinux2-aarch64-standard:3.0');
3537

3638
/**
3739
* Returns an ARM image running Linux from an ECR repository.

packages/aws-cdk-lib/aws-codebuild/lib/project.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1750,6 +1750,8 @@ export class LinuxBuildImage implements IBuildImage {
17501750
* @deprecated Use LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_2_0 instead.
17511751
* */
17521752
public static readonly AMAZON_LINUX_2_ARM_2 = LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_2_0;
1753+
/** @deprecated Use LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_3_0 instead. */
1754+
public static readonly AMAZON_LINUX_2_ARM_3 = LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_3_0;
17531755

17541756
/** @deprecated Use `STANDARD_2_0` and specify runtime in buildspec runtime-versions section */
17551757
public static readonly UBUNTU_14_04_BASE = LinuxBuildImage.codeBuildImage('aws/codebuild/ubuntu-base:14.04');

packages/aws-cdk-lib/aws-codebuild/test/linux-arm-build-image.test.ts

+78
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,84 @@ describe('Linux ARM build image', () => {
160160
});
161161
});
162162

163+
describe('AMAZON_LINUX_2_STANDARD_3_0', () => {
164+
test('has type ARM_CONTAINER and default ComputeType LARGE', () => {
165+
const stack = new cdk.Stack();
166+
new codebuild.PipelineProject(stack, 'Project', {
167+
environment: {
168+
buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_3_0,
169+
},
170+
});
171+
172+
Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', {
173+
Environment: {
174+
Type: 'ARM_CONTAINER',
175+
ComputeType: 'BUILD_GENERAL1_LARGE',
176+
},
177+
});
178+
});
179+
180+
test('can be used with ComputeType SMALL', () => {
181+
const stack = new cdk.Stack();
182+
new codebuild.PipelineProject(stack, 'Project', {
183+
environment: {
184+
computeType: codebuild.ComputeType.SMALL,
185+
buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_3_0,
186+
},
187+
});
188+
189+
Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', {
190+
Environment: {
191+
Type: 'ARM_CONTAINER',
192+
ComputeType: 'BUILD_GENERAL1_SMALL',
193+
},
194+
});
195+
});
196+
197+
test('cannot be used in conjunction with ComputeType MEDIUM', () => {
198+
const stack = new cdk.Stack();
199+
200+
expect(() => {
201+
new codebuild.PipelineProject(stack, 'Project', {
202+
environment: {
203+
buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_3_0,
204+
computeType: codebuild.ComputeType.MEDIUM,
205+
},
206+
});
207+
}).toThrow(/ARM images only support ComputeTypes 'BUILD_GENERAL1_SMALL' and 'BUILD_GENERAL1_LARGE' - 'BUILD_GENERAL1_MEDIUM' was given/);
208+
});
209+
210+
test('can be used with ComputeType LARGE', () => {
211+
const stack = new cdk.Stack();
212+
new codebuild.PipelineProject(stack, 'Project', {
213+
environment: {
214+
computeType: codebuild.ComputeType.LARGE,
215+
buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_3_0,
216+
},
217+
});
218+
219+
Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', {
220+
Environment: {
221+
Type: 'ARM_CONTAINER',
222+
ComputeType: 'BUILD_GENERAL1_LARGE',
223+
},
224+
});
225+
});
226+
227+
test('cannot be used in conjunction with ComputeType X2_LARGE', () => {
228+
const stack = new cdk.Stack();
229+
230+
expect(() => {
231+
new codebuild.PipelineProject(stack, 'Project', {
232+
environment: {
233+
buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_3_0,
234+
computeType: codebuild.ComputeType.X2_LARGE,
235+
},
236+
});
237+
}).toThrow(/ARM images only support ComputeTypes 'BUILD_GENERAL1_SMALL' and 'BUILD_GENERAL1_LARGE' - 'BUILD_GENERAL1_2XLARGE' was given/);
238+
});
239+
});
240+
163241
describe('ECR Repository', () => {
164242
test('allows creating a build image from a new ECR repository', () => {
165243
const stack = new cdk.Stack();

0 commit comments

Comments
 (0)