Skip to content

Commit a595884

Browse files
authored
fix(codebuild): support Windows Server Core 2022 image with on-demand capacity (#35152)
### Issue # (if applicable) N/A ### Reason for this change When support for the Windows Server Core 2022 image in AWS CodeBuild was initially added in #29754, the image type was not yet available for use with on-demand capacity. This has now changed apparently (and tested), so we can remove the validation preventing use. Additional removed a future looking test, since it is bad practices to add validations for the future without clearly documented evidence that this is going to happen. I've searched the current docs, and there's no note whatsoever that Windows Server Core 2022 images are not supported with on-demand capacity. ### Description of changes - Added Windows Server Core 2022 image support to the CodeBuild project configuration - Updated integration tests to include the new Windows Core 2022 image variant - Updated test snapshots to reflect the new image option ### Describe any new or updated permissions being added No new or updated IAM permissions are required for this change. ### Description of how you validated changes - Updated integration tests to include Windows Server Core 2022 image - Executed updated integration test to validate the configuration and updated test snapshots - Existing unit tests continue to pass ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 918593d commit a595884

File tree

13 files changed

+1265
-860
lines changed

13 files changed

+1265
-860
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-windows-image.js.snapshot/WinCore2019-1.assets.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-windows-image.js.snapshot/WinCore2019-2.assets.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-windows-image.js.snapshot/WinCore2019-3.assets.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-windows-image.js.snapshot/WinCore2022-3.assets.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
{
2+
"Resources": {
3+
"ProjectRole4CCB274E": {
4+
"Type": "AWS::IAM::Role",
5+
"Properties": {
6+
"AssumeRolePolicyDocument": {
7+
"Statement": [
8+
{
9+
"Action": "sts:AssumeRole",
10+
"Effect": "Allow",
11+
"Principal": {
12+
"Service": "codebuild.amazonaws.com"
13+
}
14+
}
15+
],
16+
"Version": "2012-10-17"
17+
}
18+
}
19+
},
20+
"ProjectRoleDefaultPolicy7F29461B": {
21+
"Type": "AWS::IAM::Policy",
22+
"Properties": {
23+
"PolicyDocument": {
24+
"Statement": [
25+
{
26+
"Action": [
27+
"logs:CreateLogGroup",
28+
"logs:CreateLogStream",
29+
"logs:PutLogEvents"
30+
],
31+
"Effect": "Allow",
32+
"Resource": [
33+
{
34+
"Fn::Join": [
35+
"",
36+
[
37+
"arn:",
38+
{
39+
"Ref": "AWS::Partition"
40+
},
41+
":logs:",
42+
{
43+
"Ref": "AWS::Region"
44+
},
45+
":",
46+
{
47+
"Ref": "AWS::AccountId"
48+
},
49+
":log-group:/aws/codebuild/",
50+
{
51+
"Ref": "ProjectC78D97AD"
52+
},
53+
":*"
54+
]
55+
]
56+
},
57+
{
58+
"Fn::Join": [
59+
"",
60+
[
61+
"arn:",
62+
{
63+
"Ref": "AWS::Partition"
64+
},
65+
":logs:",
66+
{
67+
"Ref": "AWS::Region"
68+
},
69+
":",
70+
{
71+
"Ref": "AWS::AccountId"
72+
},
73+
":log-group:/aws/codebuild/",
74+
{
75+
"Ref": "ProjectC78D97AD"
76+
}
77+
]
78+
]
79+
}
80+
]
81+
},
82+
{
83+
"Action": [
84+
"codebuild:BatchPutCodeCoverages",
85+
"codebuild:BatchPutTestCases",
86+
"codebuild:CreateReport",
87+
"codebuild:CreateReportGroup",
88+
"codebuild:UpdateReport"
89+
],
90+
"Effect": "Allow",
91+
"Resource": {
92+
"Fn::Join": [
93+
"",
94+
[
95+
"arn:",
96+
{
97+
"Ref": "AWS::Partition"
98+
},
99+
":codebuild:",
100+
{
101+
"Ref": "AWS::Region"
102+
},
103+
":",
104+
{
105+
"Ref": "AWS::AccountId"
106+
},
107+
":report-group/",
108+
{
109+
"Ref": "ProjectC78D97AD"
110+
},
111+
"-*"
112+
]
113+
]
114+
}
115+
}
116+
],
117+
"Version": "2012-10-17"
118+
},
119+
"PolicyName": "ProjectRoleDefaultPolicy7F29461B",
120+
"Roles": [
121+
{
122+
"Ref": "ProjectRole4CCB274E"
123+
}
124+
]
125+
}
126+
},
127+
"ProjectC78D97AD": {
128+
"Type": "AWS::CodeBuild::Project",
129+
"Properties": {
130+
"Artifacts": {
131+
"Type": "NO_ARTIFACTS"
132+
},
133+
"Cache": {
134+
"Type": "NO_CACHE"
135+
},
136+
"EncryptionKey": "alias/aws/s3",
137+
"Environment": {
138+
"ComputeType": "BUILD_GENERAL1_MEDIUM",
139+
"Image": "aws/codebuild/windows-base:2022-1.0",
140+
"ImagePullCredentialsType": "CODEBUILD",
141+
"PrivilegedMode": false,
142+
"Type": "WINDOWS_SERVER_2022_CONTAINER"
143+
},
144+
"ServiceRole": {
145+
"Fn::GetAtt": [
146+
"ProjectRole4CCB274E",
147+
"Arn"
148+
]
149+
},
150+
"Source": {
151+
"BuildSpec": "{\n \"version\": \"0.2\"\n}",
152+
"Type": "NO_SOURCE"
153+
}
154+
}
155+
}
156+
},
157+
"Parameters": {
158+
"BootstrapVersion": {
159+
"Type": "AWS::SSM::Parameter::Value<String>",
160+
"Default": "/cdk-bootstrap/hnb659fds/version",
161+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
162+
}
163+
},
164+
"Rules": {
165+
"CheckBootstrapVersion": {
166+
"Assertions": [
167+
{
168+
"Assert": {
169+
"Fn::Not": [
170+
{
171+
"Fn::Contains": [
172+
[
173+
"1",
174+
"2",
175+
"3",
176+
"4",
177+
"5"
178+
],
179+
{
180+
"Ref": "BootstrapVersion"
181+
}
182+
]
183+
}
184+
]
185+
},
186+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
187+
}
188+
]
189+
}
190+
}
191+
}

packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-windows-image.js.snapshot/cdk.out

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-windows-image.js.snapshot/integ.json

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-windows-image.js.snapshot/integprojectwindowsimagesDefaultTestDeployAssert5D19E22D.assets.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)