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

feat(codebuild): X-Large Linux compute type #28642

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/aws-cdk-lib/aws-codebuild/lib/compute-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export enum ComputeType {
SMALL = 'BUILD_GENERAL1_SMALL',
MEDIUM = 'BUILD_GENERAL1_MEDIUM',
LARGE = 'BUILD_GENERAL1_LARGE',
X_LARGE = 'BUILD_GENERAL1_XLARGE',
X2_LARGE = 'BUILD_GENERAL1_2XLARGE',
LAMBDA_1GB = 'BUILD_LAMBDA_1GB',
LAMBDA_2GB = 'BUILD_LAMBDA_2GB',
Expand Down
3 changes: 2 additions & 1 deletion packages/aws-cdk-lib/aws-codebuild/lib/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2117,7 +2117,8 @@ export class WindowsBuildImage implements IBuildImage {
errors.push('Windows images do not support Lambda compute types');
}

if (buildEnvironment.computeType === ComputeType.SMALL || buildEnvironment.computeType === ComputeType.X2_LARGE) {
const unsupportedComputeTypes = [ComputeType.SMALL, ComputeType.X_LARGE, ComputeType.X2_LARGE];
if (buildEnvironment.computeType !== undefined && unsupportedComputeTypes.includes(buildEnvironment.computeType)) {
errors.push(`Windows images do not support the '${buildEnvironment.computeType}' compute type`);
}
return errors;
Expand Down
18 changes: 18 additions & 0 deletions packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1617,6 +1617,24 @@ test('using ComputeType.Small with a Windows image fails validation', () => {
}).toThrow(/Windows images do not support the 'BUILD_GENERAL1_SMALL' compute type/);
});

test('using ComputeType.XLarge with a Windows image fails validation', () => {
const stack = new cdk.Stack();
const invalidEnvironment: codebuild.BuildEnvironment = {
buildImage: codebuild.WindowsBuildImage.WIN_SERVER_CORE_2019_BASE,
computeType: codebuild.ComputeType.X_LARGE,
};

expect(() => {
new codebuild.Project(stack, 'MyProject', {
source: codebuild.Source.s3({
bucket: new s3.Bucket(stack, 'MyBucket'),
path: 'path',
}),
environment: invalidEnvironment,
});
}).toThrow(/Windows images do not support the 'BUILD_GENERAL1_XLARGE' compute type/);
});

test('using ComputeType.X2Large with a Windows image fails validation', () => {
const stack = new cdk.Stack();
const invalidEnvironment: codebuild.BuildEnvironment = {
Expand Down
Loading