Skip to content

Commit 0ea4ea3

Browse files
authoredAug 12, 2020
chore: secret scan in CodeBuild test (aws#9657)
As it turns out, our secret scan was flagging the 'account' part of the mapping generated for the AWS Deep Learning Containers image repositories. Turn them into 'repositoryAccount' instead to silence the scanner. Also, actually enable the scanner to run correctly for PR builds as well. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 4c62702 commit 0ea4ea3

File tree

3 files changed

+46
-46
lines changed

3 files changed

+46
-46
lines changed
 

‎git-secrets-scan.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ mkdir -p .tools
2121
git rev-parse --git-dir > /dev/null 2>&1 || {
2222
git init --quiet
2323
git add -A .
24-
25-
# AWS config needs to be added to this fresh repository's config
26-
.tools/git-secrets/git-secrets --register-aws
2724
}
2825

26+
# AWS config needs to be added to this repository's config
27+
.tools/git-secrets/git-secrets --register-aws
28+
2929
.tools/git-secrets/git-secrets --scan
3030
echo "git-secrets scan ok"

‎packages/@aws-cdk/aws-codebuild/lib/linux-gpu-build-image.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class LinuxGpuBuildImage implements IBindableBuildImage {
9595
private readonly accountExpression: string;
9696

9797
private constructor(private readonly repositoryName: string, tag: string, private readonly account: string | undefined) {
98-
this.accountExpression = account ?? core.Fn.findInMap(mappingName, core.Aws.REGION, 'account');
98+
this.accountExpression = account ?? core.Fn.findInMap(mappingName, core.Aws.REGION, 'repositoryAccount');
9999
this.imageId = `${this.accountExpression}.dkr.ecr.${core.Aws.REGION}.${core.Aws.URL_SUFFIX}/${repositoryName}:${tag}`;
100100
}
101101

@@ -109,7 +109,7 @@ export class LinuxGpuBuildImage implements IBindableBuildImage {
109109
// get the accounts from the region-info module
110110
const region2Accounts = RegionInfo.regionMap(FactName.DLC_REPOSITORY_ACCOUNT);
111111
for (const [region, account] of Object.entries(region2Accounts)) {
112-
mapping[region] = { account };
112+
mapping[region] = { repositoryAccount: account };
113113
}
114114
new core.CfnMapping(scopeStack, mappingName, { mapping });
115115
}

‎packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.expected.json

+41-41
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
{
139139
"Ref": "AWS::Region"
140140
},
141-
"account"
141+
"repositoryAccount"
142142
]
143143
},
144144
":repository/mxnet-training"
@@ -180,7 +180,7 @@
180180
{
181181
"Ref": "AWS::Region"
182182
},
183-
"account"
183+
"repositoryAccount"
184184
]
185185
},
186186
".dkr.ecr.",
@@ -214,65 +214,65 @@
214214
},
215215
"Mappings": {
216216
"AwsDeepLearningContainersRepositoriesAccounts": {
217-
"us-east-1": {
218-
"account": "763104351884"
217+
"ap-east-1": {
218+
"repositoryAccount": "871362719292"
219219
},
220-
"us-east-2": {
221-
"account": "763104351884"
220+
"ap-northeast-1": {
221+
"repositoryAccount": "763104351884"
222222
},
223-
"us-west-1": {
224-
"account": "763104351884"
223+
"ap-northeast-2": {
224+
"repositoryAccount": "763104351884"
225225
},
226-
"us-west-2": {
227-
"account": "763104351884"
226+
"ap-south-1": {
227+
"repositoryAccount": "763104351884"
228228
},
229-
"ca-central-1": {
230-
"account": "763104351884"
229+
"ap-southeast-1": {
230+
"repositoryAccount": "763104351884"
231231
},
232-
"eu-west-1": {
233-
"account": "763104351884"
232+
"ap-southeast-2": {
233+
"repositoryAccount": "763104351884"
234234
},
235-
"eu-west-2": {
236-
"account": "763104351884"
235+
"ca-central-1": {
236+
"repositoryAccount": "763104351884"
237237
},
238-
"eu-west-3": {
239-
"account": "763104351884"
238+
"cn-north-1": {
239+
"repositoryAccount": "727897471807"
240+
},
241+
"cn-northwest-1": {
242+
"repositoryAccount": "727897471807"
240243
},
241244
"eu-central-1": {
242-
"account": "763104351884"
245+
"repositoryAccount": "763104351884"
243246
},
244247
"eu-north-1": {
245-
"account": "763104351884"
246-
},
247-
"sa-east-1": {
248-
"account": "763104351884"
248+
"repositoryAccount": "763104351884"
249249
},
250-
"ap-south-1": {
251-
"account": "763104351884"
250+
"eu-west-1": {
251+
"repositoryAccount": "763104351884"
252252
},
253-
"ap-northeast-1": {
254-
"account": "763104351884"
253+
"eu-west-2": {
254+
"repositoryAccount": "763104351884"
255255
},
256-
"ap-northeast-2": {
257-
"account": "763104351884"
256+
"eu-west-3": {
257+
"repositoryAccount": "763104351884"
258258
},
259-
"ap-southeast-1": {
260-
"account": "763104351884"
259+
"me-south-1": {
260+
"repositoryAccount": "217643126080"
261261
},
262-
"ap-southeast-2": {
263-
"account": "763104351884"
262+
"sa-east-1": {
263+
"repositoryAccount": "763104351884"
264264
},
265-
"ap-east-1": {
266-
"account": "871362719292"
265+
"us-east-1": {
266+
"repositoryAccount": "763104351884"
267267
},
268-
"me-south-1": {
269-
"account": "217643126080"
268+
"us-east-2": {
269+
"repositoryAccount": "763104351884"
270270
},
271-
"cn-north-1": {
272-
"account": "727897471807"
271+
"us-west-1": {
272+
"repositoryAccount": "763104351884"
273273
},
274-
"cn-northwest-1": {
275-
"account": "727897471807"
274+
"us-west-2": {
275+
"repositoryAccount": "763104351884"
276276
}
277277
}
278278
}

0 commit comments

Comments
 (0)
Please sign in to comment.