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

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

Closed
wants to merge 1 commit into from
Closed

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

wants to merge 1 commit into from

Conversation

awschristou
Copy link

@awschristou awschristou commented Feb 20, 2024

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.

Additionally:

  • a missing validation for WindowsBuildImage.WIN_SERVER_CORE_2019_BASE was added to the tests

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

@github-actions github-actions bot added p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Feb 20, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team February 20, 2024 22:46
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@awschristou awschristou changed the title Add CodeBuild image definition WIN_SERVER_CORE_2019_BASE_3_0 chore(codebuild): add support for Windows Server Core 2019 3.0 CodeBuild image Feb 20, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review February 20, 2024 22:53

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Mar 1, 2024
Copy link
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍
I left some comments for adjustments

imagePullPrincipalType: ImagePullPrincipalType.CODEBUILD,
imageType: WindowsImageType.SERVER_2019,
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please also add support for aws/codebuild/windows-base:2022-1.0?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aws/codebuild/windows-base:2022-1.0 requires an alternate configuration -- this requires reserved capacity. This should be added as a dedicated change.

I don't have time to validate that adding aws/codebuild/windows-base:2022-1.0 works correctly, so I'm not inclined to add it to this change.

@@ -798,6 +798,7 @@ describe('Environment', () => {
['Amazon Linux 4.0', codebuild.LinuxBuildImage.AMAZON_LINUX_2_4, 'aws/codebuild/amazonlinux2-x86_64-standard:4.0'],
['Amazon Linux 5.0', codebuild.LinuxBuildImage.AMAZON_LINUX_2_5, 'aws/codebuild/amazonlinux2-x86_64-standard:5.0'],
['Windows Server Core 2019 2.0', codebuild.WindowsBuildImage.WIN_SERVER_CORE_2019_BASE_2_0, 'aws/codebuild/windows-base:2019-2.0'],
['Windows Server Core 2019 3.0', codebuild.WindowsBuildImage.WIN_SERVER_CORE_2019_BASE_3_0, 'aws/codebuild/windows-base:2019-3.0'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please also add aws/codebuild/windows-base:2019-1.0 and aws/codebuild/windows-base:2022-1.0 to this test?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the missing test for 2019-1.0.

I didn't add 2022-1.0 - see #29187 (comment)

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Mar 3, 2024
@TheRealAmazonKendra
Copy link
Contributor

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.

@awschristou
Copy link
Author

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 awschristou closed this Mar 5, 2024
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants