Skip to content

Commit 9374642

Browse files
feat(codebuild): expose aws/windows/base:2.0 image (#7004)
The 1.0 version of this image, while still supported by the service, is no longer documented on the CodeBuild supported images documentation. Users are recommended to upgrade to the 2.0 version of the image, which also comes with up-to-date versions of Node, DotNet SDK, etc... This PR makes a new `WindowsBuildImage.WINDOWS_BASE_2_0` constant available to easily access this build image, and proceeds to deprecate the older `WindowsBuildImage.WIN_SERVER_CORE_2016_BASE` image. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent fe0b057 commit 9374642

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

packages/@aws-cdk/aws-codebuild/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ The CodeBuild library supports both Linux and Windows images via the
189189
`LinuxBuildImage` and `WindowsBuildImage` classes, respectively.
190190

191191
You can either specify one of the predefined Windows/Linux images by using one
192-
of the constants such as `WindowsBuildImage.WIN_SERVER_CORE_2016_BASE` or
192+
of the constants such as `WindowsBuildImage.WINDOWS_BASE_2_0` or
193193
`LinuxBuildImage.STANDARD_2_0`.
194194

195195
Alternatively, you can specify a custom image using one of the static methods on

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

+14
Original file line numberDiff line numberDiff line change
@@ -1394,11 +1394,25 @@ interface WindowsBuildImageProps {
13941394
* @see https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html
13951395
*/
13961396
export class WindowsBuildImage implements IBuildImage {
1397+
/**
1398+
* Corresponds to the standard CodeBuild image `aws/codebuild/windows-base:1.0`.
1399+
*
1400+
* @deprecated `WindowsBuildImage.WINDOWS_BASE_2_0` should be used instead.
1401+
*/
13971402
public static readonly WIN_SERVER_CORE_2016_BASE: IBuildImage = new WindowsBuildImage({
13981403
imageId: 'aws/codebuild/windows-base:1.0',
13991404
imagePullPrincipalType: ImagePullPrincipalType.CODEBUILD,
14001405
});
14011406

1407+
/**
1408+
* The standard CodeBuild image `aws/codebuild/windows-base:2.0`, which is
1409+
* based off Windows Server Core 2016.
1410+
*/
1411+
public static readonly WINDOWS_BASE_2_0: IBuildImage = new WindowsBuildImage({
1412+
imageId: 'aws/codebuild/windows-base:2.0',
1413+
imagePullPrincipalType: ImagePullPrincipalType.CODEBUILD,
1414+
});
1415+
14021416
/**
14031417
* @returns a Windows build image from a Docker Hub image.
14041418
*/

packages/@aws-cdk/aws-codebuild/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@
176176
"docs-public-apis:@aws-cdk/aws-codebuild.Source.gitHubEnterprise",
177177
"docs-public-apis:@aws-cdk/aws-codebuild.Source.s3",
178178
"docs-public-apis:@aws-cdk/aws-codebuild.StateChangeEvent.currentPhase",
179-
"docs-public-apis:@aws-cdk/aws-codebuild.WindowsBuildImage.WIN_SERVER_CORE_2016_BASE",
180179
"docs-public-apis:@aws-cdk/aws-codebuild.WindowsBuildImage.fromDockerRegistry",
181180
"docs-public-apis:@aws-cdk/aws-codebuild.WindowsBuildImage.fromEcrRepository",
182181
"props-default-doc:@aws-cdk/aws-codebuild.ArtifactsProps.identifier",

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ export = {
303303
path: 'path/to/source.zip',
304304
}),
305305
environment: {
306-
buildImage: codebuild.WindowsBuildImage.WIN_SERVER_CORE_2016_BASE,
306+
buildImage: codebuild.WindowsBuildImage.WINDOWS_BASE_2_0,
307307
},
308308
});
309309

@@ -442,7 +442,7 @@ export = {
442442
},
443443
"Environment": {
444444
"ComputeType": "BUILD_GENERAL1_MEDIUM",
445-
"Image": "aws/codebuild/windows-base:1.0",
445+
"Image": "aws/codebuild/windows-base:2.0",
446446
"PrivilegedMode": false,
447447
"Type": "WINDOWS_CONTAINER"
448448
},
@@ -1280,7 +1280,7 @@ export = {
12801280
'using ComputeType.Small with a Windows image fails validation'(test: Test) {
12811281
const stack = new cdk.Stack();
12821282
const invalidEnvironment: codebuild.BuildEnvironment = {
1283-
buildImage: codebuild.WindowsBuildImage.WIN_SERVER_CORE_2016_BASE,
1283+
buildImage: codebuild.WindowsBuildImage.WINDOWS_BASE_2_0,
12841284
computeType: codebuild.ComputeType.SMALL,
12851285
};
12861286

0 commit comments

Comments
 (0)