Skip to content

Commit

Permalink
fix: explicitly set the 'ImagePullPrincipalType' of image (aws#11264)
Browse files Browse the repository at this point in the history
closes aws#10569 as workaround for the violation of CloudFormation of CodeBuild

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
zxkane authored Nov 3, 2020
1 parent ed6e7ed commit 29aa223
Show file tree
Hide file tree
Showing 20 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codebuild/lib/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ export class Project extends ProjectBase {
}

const imagePullPrincipalType = this.buildImage.imagePullPrincipalType === ImagePullPrincipalType.CODEBUILD
? undefined
? ImagePullPrincipalType.CODEBUILD
: ImagePullPrincipalType.SERVICE_ROLE;
if (this.buildImage.repository) {
if (imagePullPrincipalType === ImagePullPrincipalType.SERVICE_ROLE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:1.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:1.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:1.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_LARGE",
"Image": "aws/codebuild/standard:1.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:1.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:1.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": true,
"Type": "LINUX_CONTAINER"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:1.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:1.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export = {
'Type': 'LINUX_CONTAINER',
'PrivilegedMode': false,
'Image': 'aws/codebuild/standard:1.0',
'ImagePullCredentialsType': 'CODEBUILD',
'ComputeType': 'BUILD_GENERAL1_SMALL',
},
'EncryptionKey': 'alias/aws/s3',
Expand Down Expand Up @@ -315,6 +316,7 @@ export = {
'Environment': {
'ComputeType': 'BUILD_GENERAL1_SMALL',
'Image': 'aws/codebuild/standard:1.0',
'ImagePullCredentialsType': 'CODEBUILD',
'PrivilegedMode': false,
'Type': 'LINUX_CONTAINER',
},
Expand Down Expand Up @@ -514,6 +516,7 @@ export = {
'Environment': {
'ComputeType': 'BUILD_GENERAL1_MEDIUM',
'Image': 'aws/codebuild/windows-base:2.0',
'ImagePullCredentialsType': 'CODEBUILD',
'PrivilegedMode': false,
'Type': 'WINDOWS_CONTAINER',
},
Expand Down Expand Up @@ -1205,6 +1208,7 @@ export = {
'Type': 'LINUX_CONTAINER',
'PrivilegedMode': false,
'Image': 'aws/codebuild/standard:1.0',
'ImagePullCredentialsType': 'CODEBUILD',
'ComputeType': 'BUILD_GENERAL1_SMALL',
},
}));
Expand Down Expand Up @@ -1449,6 +1453,7 @@ export = {
],
'PrivilegedMode': false,
'Image': 'aws/codebuild/standard:1.0',
'ImagePullCredentialsType': 'CODEBUILD',
'ComputeType': 'BUILD_GENERAL1_SMALL',
},
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/nodejs:10.1.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down Expand Up @@ -1777,6 +1778,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/nodejs:10.1.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:1.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:1.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@
}
],
"Image": "aws/codebuild/docker:17.09.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": true,
"Type": "LINUX_CONTAINER"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:1.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:1.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
}
],
"Image": "aws/codebuild/standard:1.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:4.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down Expand Up @@ -1267,6 +1268,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:4.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down Expand Up @@ -1473,6 +1475,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:4.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down Expand Up @@ -1647,6 +1650,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:4.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down Expand Up @@ -1677,6 +1681,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:4.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/@aws-cdk/pipelines/test/integ.pipeline.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:4.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down Expand Up @@ -1166,6 +1167,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:4.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down Expand Up @@ -1372,6 +1374,7 @@
"Environment": {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:4.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER"
},
Expand Down
1 change: 1 addition & 0 deletions packages/decdk/test/__snapshots__/synth.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1638,6 +1638,7 @@ Object {
"Environment": Object {
"ComputeType": "BUILD_GENERAL1_SMALL",
"Image": "aws/codebuild/standard:1.0",
"ImagePullCredentialsType": "CODEBUILD",
"PrivilegedMode": false,
"Type": "LINUX_CONTAINER",
},
Expand Down

0 comments on commit 29aa223

Please sign in to comment.