@@ -44,16 +44,10 @@ Resources:
4444 BuildSpec : codebuild/ci/ci.yml
4545 GitCloneDepth : 1
4646 GitSubmodulesConfig :
47- FetchSubmodules : false
47+ FetchSubmodules : true
4848 InsecureSsl : false
4949 ReportBuildStatus : false
5050 Type : GITHUB
51- Triggers :
52- BuildType : BUILD_BATCH
53- Webhook : true
54- FilterGroups :
55- - - Type : EVENT
56- Pattern : PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED, PULL_REQUEST_REOPENED
5751 Artifacts :
5852 Type : NO_ARTIFACTS
5953 Cache :
@@ -93,7 +87,9 @@ Resources:
9387 Source :
9488 Location : !Ref SourceLocation
9589 BuildSpec : codebuild/release/release.yml
96- GitCloneDepth : 1
90+ # # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-source.html#cfn-codebuild-project-source-gitclonedepth
91+ # # If this value is 0, greater than 25, or not provided then the full history is downloaded with each build project.
92+ GitCloneDepth : 0
9793 GitSubmodulesConfig :
9894 FetchSubmodules : false
9995 InsecureSsl : false
@@ -136,14 +132,15 @@ Resources:
136132 Path : /service-role/
137133 RoleName : !Sub "codebuild-${ProjectName}-service-role-ci"
138134 AssumeRolePolicyDocument : >-
139- {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"codebuild.amazonaws.com"},"Action":"sts:AssumeRole"}]}
135+ {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"codebuild.amazonaws.com"},"Action":"sts:AssumeRole"},{"Effect":"Allow","Principal":{"Federated":"arn:aws:iam::587316601012:oidc-provider/token.actions.githubusercontent.com"},"Action":"sts:AssumeRoleWithWebIdentity","Condition":{"StringEquals":{"token.actions.githubusercontent.com:aud":"sts.amazonaws.com"},"StringLike":{"token.actions.githubusercontent.com:sub":"repo:aws/aws-encryption-sdk-java:*"}}} ]}
140136 MaxSessionDuration : 3600
141137 ManagedPolicyArns :
142138 - !Ref CryptoToolsKMS
143139 - !Ref CodeBuildBatchPolicy
144140 - !Ref CodeBuildBasePolicy
145141 - !Ref SecretsManagerPolicyCI
146142 - !Ref ParameterStorePolicy
143+ - !Ref CodeBuildBasePolicyCI
147144 - " arn:aws:iam::aws:policy/AWSCodeArtifactReadOnlyAccess"
148145 - " arn:aws:iam::aws:policy/AWSCodeArtifactAdminAccess"
149146
@@ -158,6 +155,7 @@ Resources:
158155 ManagedPolicyArns :
159156 - !Ref CryptoToolsKMS
160157 - !Ref CodeBuildBatchPolicy
158+ - !Ref CodeBuildBatchPolicyRelease
161159 - !Ref CodeBuildBasePolicy
162160 - !Ref SecretsManagerPolicyRelease
163161 - !Ref ParameterStorePolicy
@@ -184,12 +182,37 @@ Resources:
184182 "Action": [
185183 "codebuild:StartBuild",
186184 "codebuild:StopBuild",
187- "codebuild:RetryBuild"
185+ "codebuild:RetryBuild",
186+ "codebuild:BatchGetBuilds"
188187 ]
189188 }
190189 ]
191190 }
192191
192+ CodeBuildBatchPolicyRelease :
193+ Type : " AWS::IAM::ManagedPolicy"
194+ Properties :
195+ ManagedPolicyName : !Sub >-
196+ CodeBuildBuildBatchPolicy-${ProjectName}-Release-${AWS::Region}-codebuild-${ProjectName}-release-service-role
197+ Path : /service-role/
198+ PolicyDocument : !Sub |
199+ {
200+ "Version": "2012-10-17",
201+ "Statement": [
202+ {
203+ "Effect": "Allow",
204+ "Resource": [
205+ "arn:aws:codebuild:us-west-2:${AWS::AccountId}:project/AWS-ESDK-Java-Release"
206+ ],
207+ "Action": [
208+ "codebuild:StartBuild",
209+ "codebuild:StopBuild",
210+ "codebuild:RetryBuild"
211+ ]
212+ }
213+ ]
214+ }
215+
193216 CodeBuildBasePolicy :
194217 Type : " AWS::IAM::ManagedPolicy"
195218 Properties :
@@ -212,7 +235,8 @@ Resources:
212235 "Action": [
213236 "logs:CreateLogGroup",
214237 "logs:CreateLogStream",
215- "logs:PutLogEvents"
238+ "logs:PutLogEvents",
239+ "logs:GetLogEvents"
216240 ]
217241 },
218242 {
@@ -244,6 +268,56 @@ Resources:
244268 ]
245269 }
246270
271+ CodeBuildBasePolicyCI :
272+ Type : " AWS::IAM::ManagedPolicy"
273+ Properties :
274+ ManagedPolicyName : !Sub "CodeBuildBasePolicy-${ProjectName}-CI-${AWS::Region}"
275+ Path : /service-role/
276+ PolicyDocument : !Sub |
277+ {
278+ "Version": "2012-10-17",
279+ "Statement": [
280+ {
281+ "Effect": "Allow",
282+ "Resource": [
283+ "arn:aws:logs:us-west-2:${AWS::AccountId}:log-group:/aws/codebuild/AWS-ESDK-Java-CI",
284+ "arn:aws:logs:us-west-2:${AWS::AccountId}:log-group:/aws/codebuild/AWS-ESDK-Java-CI:*"
285+ ],
286+ "Action": [
287+ "logs:CreateLogGroup",
288+ "logs:CreateLogStream",
289+ "logs:PutLogEvents"
290+ ]
291+ },
292+ {
293+ "Effect": "Allow",
294+ "Resource": [
295+ "arn:aws:s3:::codepipeline-us-west-2-*"
296+ ],
297+ "Action": [
298+ "s3:PutObject",
299+ "s3:GetObject",
300+ "s3:GetObjectVersion",
301+ "s3:GetBucketAcl",
302+ "s3:GetBucketLocation"
303+ ]
304+ },
305+ {
306+ "Effect": "Allow",
307+ "Action": [
308+ "codebuild:CreateReportGroup",
309+ "codebuild:CreateReport",
310+ "codebuild:UpdateReport",
311+ "codebuild:BatchPutTestCases",
312+ "codebuild:BatchPutCodeCoverages"
313+ ],
314+ "Resource": [
315+ "arn:aws:codebuild:us-west-2:${AWS::AccountId}:report-group/AWS-ESDK-Java-CI-*"
316+ ]
317+ }
318+ ]
319+ }
320+
247321 AccountIdParameter :
248322 Type : " AWS::SSM::Parameter"
249323 Properties :
@@ -264,7 +338,8 @@ Resources:
264338 {
265339 "Effect": "Allow",
266340 "Resource": [
267- "arn:aws:secretsmanager:us-west-2:${AWS::AccountId}:secret:Maven-GPG-Keys-GC6h0A"
341+ "arn:aws:secretsmanager:us-west-2:${AWS::AccountId}:secret:Maven-GPG-Keys-CI-xjAvTM",
342+ "arn:aws:secretsmanager:us-west-2:${AWS::AccountId}:secret:Maven-GPG-Keys-CI-Credentials-eBrSNB"
268343 ],
269344 "Action": "secretsmanager:GetSecretValue"
270345 }
@@ -283,8 +358,10 @@ Resources:
283358 {
284359 "Effect": "Allow",
285360 "Resource": [
286- "arn:aws:secretsmanager:us-west-2:${AWS::AccountId}:secret:Maven-GPG-Keys-GC6h0A",
287- "arn:aws:secretsmanager:us-west-2:${AWS::AccountId}:secret:Sonatype-Team-Account-0tWvZm"
361+ "arn:aws:secretsmanager:us-west-2:${AWS::AccountId}:secret:Maven-GPG-Keys-Release-haLIjZ",
362+ "arn:aws:secretsmanager:us-west-2:${AWS::AccountId}:secret:Maven-GPG-Keys-Release-Credentials-WgJanS",
363+ "arn:aws:secretsmanager:us-west-2:${AWS::AccountId}:secret:Sonatype-Team-Account-0tWvZm",
364+ "arn:aws:secretsmanager:us-west-2:${AWS::AccountId}:secret:Github/aws-crypto-tools-ci-bot-AGUB3U"
288365 ],
289366 "Action": "secretsmanager:GetSecretValue"
290367 }
0 commit comments