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

fix(codebuild): add possibility to specify BUILD_GENERAL1_SMALL compute type with Linux GPU build image #25880

Merged
merged 2 commits into from
Jun 12, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ export class LinuxGpuBuildImage implements IBindableBuildImage {
public validate(buildEnvironment: BuildEnvironment): string[] {
const ret = [];
if (buildEnvironment.computeType &&
buildEnvironment.computeType !== ComputeType.LARGE) {
ret.push(`GPU images only support ComputeType '${ComputeType.LARGE}' - ` +
buildEnvironment.computeType !== ComputeType.LARGE &&
buildEnvironment.computeType !== ComputeType.SMALL) {
ret.push(`GPU images only support ComputeType '${ComputeType.LARGE}' and '${ComputeType.SMALL}' - ` +
`'${buildEnvironment.computeType}' was given`);
}
return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,39 @@ describe('Linux GPU build image', () => {
},
});
});

test('allows to specify a BUILD_GENERAL1_SMALL build environment', () => {
const stack = new cdk.Stack();

new codebuild.Project(stack, 'Project', {
buildSpec: codebuild.BuildSpec.fromObject({
version: '0.2',
phases: {
build: { commands: ['ls'] },
},
}),
environment: {
buildImage: codebuild.LinuxGpuBuildImage.awsDeepLearningContainersImage(
'my-repo', 'my-tag', '123456789012'),
computeType: codebuild.ComputeType.SMALL,
},
});

Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', {
Environment: {
ComputeType: 'BUILD_GENERAL1_SMALL',
Image: {
'Fn::Join': ['', [
'123456789012.dkr.ecr.',
{ Ref: 'AWS::Region' },
'.',
{ Ref: 'AWS::URLSuffix' },
'/my-repo:my-tag',
]],
},
},
});
});
});

describe('ECR Repository', () => {
Expand Down