Skip to content

Commit 7912d88

Browse files
authored
feat(codebuild): X-Large Linux compute type (#28642)
https://aws.amazon.com/about-aws/whats-new/2024/01/aws-codebuild-x-large-linux-compute-type/ ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent a63ef74 commit 7912d88

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

packages/aws-cdk-lib/aws-codebuild/lib/compute-type.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export enum ComputeType {
55
SMALL = 'BUILD_GENERAL1_SMALL',
66
MEDIUM = 'BUILD_GENERAL1_MEDIUM',
77
LARGE = 'BUILD_GENERAL1_LARGE',
8+
X_LARGE = 'BUILD_GENERAL1_XLARGE',
89
X2_LARGE = 'BUILD_GENERAL1_2XLARGE',
910
LAMBDA_1GB = 'BUILD_LAMBDA_1GB',
1011
LAMBDA_2GB = 'BUILD_LAMBDA_2GB',

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2117,7 +2117,8 @@ export class WindowsBuildImage implements IBuildImage {
21172117
errors.push('Windows images do not support Lambda compute types');
21182118
}
21192119

2120-
if (buildEnvironment.computeType === ComputeType.SMALL || buildEnvironment.computeType === ComputeType.X2_LARGE) {
2120+
const unsupportedComputeTypes = [ComputeType.SMALL, ComputeType.X_LARGE, ComputeType.X2_LARGE];
2121+
if (buildEnvironment.computeType !== undefined && unsupportedComputeTypes.includes(buildEnvironment.computeType)) {
21212122
errors.push(`Windows images do not support the '${buildEnvironment.computeType}' compute type`);
21222123
}
21232124
return errors;

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,6 +1617,24 @@ test('using ComputeType.Small with a Windows image fails validation', () => {
16171617
}).toThrow(/Windows images do not support the 'BUILD_GENERAL1_SMALL' compute type/);
16181618
});
16191619

1620+
test('using ComputeType.XLarge with a Windows image fails validation', () => {
1621+
const stack = new cdk.Stack();
1622+
const invalidEnvironment: codebuild.BuildEnvironment = {
1623+
buildImage: codebuild.WindowsBuildImage.WIN_SERVER_CORE_2019_BASE,
1624+
computeType: codebuild.ComputeType.X_LARGE,
1625+
};
1626+
1627+
expect(() => {
1628+
new codebuild.Project(stack, 'MyProject', {
1629+
source: codebuild.Source.s3({
1630+
bucket: new s3.Bucket(stack, 'MyBucket'),
1631+
path: 'path',
1632+
}),
1633+
environment: invalidEnvironment,
1634+
});
1635+
}).toThrow(/Windows images do not support the 'BUILD_GENERAL1_XLARGE' compute type/);
1636+
});
1637+
16201638
test('using ComputeType.X2Large with a Windows image fails validation', () => {
16211639
const stack = new cdk.Stack();
16221640
const invalidEnvironment: codebuild.BuildEnvironment = {

0 commit comments

Comments
 (0)