aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

chore(codebuild): add support for Windows Server Core 2019 3.0 CodeBuild image

Open awschristou opened this issue 1 year ago • 1 comments

Issue # N/A

Closes # N/A

Reason for this change

CodeBuild now has a Windows Server Core 2019 3.0 image (reference: Images), but this is not available from CDK.

Description of changes

Add definition for WIN_SERVER_CORE_2019_BASE_3_0 to the CDK. This change is similar to #22259, which added the Base 2.0 image.

Description of how you validated changes

I added a test into packages/aws-cdk-lib/aws-codebuild/test/project.test.ts, and ran it using the commands:

cd packages/aws-cdk-lib/
yarn test aws-codebuild/

The tests passed.

I also validated the change by attempting a deployment that uses it. I created a file in packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/sample.ts with the contents:

import { App, Stack } from 'aws-cdk-lib'
import { BuildSpec, Project, WindowsBuildImage } from 'aws-cdk-lib/aws-codebuild'

const app = new App()
const env = { region: 'us-west-2', account: 'XXXXXX' }

const stack = new Stack(app, 'cc2-cdk-dev-test', { env: env })

new Project(stack, 'sample-win-3-image', {
    buildSpec: BuildSpec.fromObject({
        version: '0.2',
        phases: {
            build: { commands: ['echo "hello world!"'] }
        }
    }),
    environment: { buildImage: WindowsBuildImage.WIN_SERVER_CORE_2019_BASE_3_0 }
})

And then I ran

cd packages/@aws-cdk-testing/framework-integ
yarn watch
npx cdk -a test/aws-codebuild/test/sample.js deploy

This produced a stack containing a CodeBuild project, which successfully runs using the new Base 3.0 image.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

awschristou avatar Feb 20 '24 22:02 awschristou

Apologies, I didn't look for an existing PR before also making this change. It just merged, but it did not include the Windows 22 version because I didn't see it listed here so if you would still like to make that change we would definitely welcome it.

TheRealAmazonKendra avatar Mar 05 '24 04:03 TheRealAmazonKendra

Apologies, I didn't look for an existing PR before also making this change. It just merged, but it did not include the Windows 22 version because I didn't see it listed here so if you would still like to make that change we would definitely welcome it.

Thanks @TheRealAmazonKendra , it looks like this PR is a duplicate of #29358 - I will close this PR.

awschristou avatar Mar 05 '24 16:03 awschristou

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 3d72d5a107e06cc1b31fd8bab8d11ecd92afa043
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

aws-cdk-automation avatar Mar 05 '24 16:03 aws-cdk-automation