Skip to content

Commit

Permalink
Merge branch 'main' into colifran/migrate-handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
colifran authored Nov 28, 2023
2 parents 03ed6cd + 640817b commit a9bfb29
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
8 changes: 5 additions & 3 deletions packages/aws-cdk-lib/aws-codebuild/lib/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1955,7 +1955,7 @@ export class WindowsBuildImage implements IBuildImage {
/**
* Corresponds to the standard CodeBuild image `aws/codebuild/windows-base:1.0`.
*
* @deprecated `WindowsBuildImage.WINDOWS_BASE_2_0` should be used instead.
* @deprecated `WindowsBuildImage.WIN_SERVER_CORE_2019_BASE_2_0` should be used instead.
*/
public static readonly WIN_SERVER_CORE_2016_BASE: IBuildImage = new WindowsBuildImage({
imageId: 'aws/codebuild/windows-base:1.0',
Expand All @@ -1965,6 +1965,8 @@ export class WindowsBuildImage implements IBuildImage {
/**
* The standard CodeBuild image `aws/codebuild/windows-base:2.0`, which is
* based off Windows Server Core 2016.
*
* @deprecated `WindowsBuildImage.WIN_SERVER_CORE_2019_BASE_2_0` should be used instead.
*/
public static readonly WINDOWS_BASE_2_0: IBuildImage = new WindowsBuildImage({
imageId: 'aws/codebuild/windows-base:2.0',
Expand Down Expand Up @@ -2066,8 +2068,8 @@ export class WindowsBuildImage implements IBuildImage {

public validate(buildEnvironment: BuildEnvironment): string[] {
const ret: string[] = [];
if (buildEnvironment.computeType === ComputeType.SMALL) {
ret.push('Windows images do not support the Small ComputeType');
if (buildEnvironment.computeType === ComputeType.SMALL || buildEnvironment.computeType === ComputeType.X2_LARGE) {
ret.push(`Windows images do not support the '${buildEnvironment.computeType}' compute type`);
}
return ret;
}
Expand Down
20 changes: 19 additions & 1 deletion packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,25 @@ test('using ComputeType.Small with a Windows image fails validation', () => {
}),
environment: invalidEnvironment,
});
}).toThrow(/Windows images do not support the Small ComputeType/);
}).toThrow(/Windows images do not support the 'BUILD_GENERAL1_SMALL' compute type/);
});

test('using ComputeType.X2Large 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.X2_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_2XLARGE' compute type/);
});

test('fromCodebuildImage', () => {
Expand Down

0 comments on commit a9bfb29

Please sign in to comment.