@@ -25,12 +25,18 @@ Parameters:
25
25
CodeStarConnectionResourceId :
26
26
Type : String
27
27
Description : The Resource Id component of the CodeStar connection ARN for the code-dot-org GitHub repository
28
- Default : 7df08bcf-9883-42e8-8f5e-d083419d4fe9
28
+ Default : 9e27ebd6-de25-495c-9a2d-b24077376de8
29
+ Mode :
30
+ Type : String
31
+ Description : Whether this should create a pipeline for an 'adhoc' deployment or 'standard' pipeline.
32
+ Default : standard
33
+ AllowedValues : [adhoc, standard]
29
34
30
35
Conditions :
31
- TargetsMainBranch : !Equals
32
- - !Ref GitHubBranch
33
- - main
36
+ TargetsMainBranch : !Equals [ !Ref GitHubBranch, main ]
37
+ DeployToAdhoc : !Equals [!Ref Mode, adhoc ]
38
+ DeployToTestAndProd : !Equals [!Ref Mode, standard ]
39
+
34
40
35
41
Resources :
36
42
@@ -211,7 +217,7 @@ Resources:
211
217
JavabuilderRolePolicy :
212
218
Type : ' AWS::IAM::Policy'
213
219
Properties :
214
- PolicyName : root
220
+ PolicyName : !Sub "${AWS::StackName}-codebuild-policy"
215
221
PolicyDocument :
216
222
Version : " 2012-10-17"
217
223
Statement :
@@ -261,7 +267,6 @@ Resources:
261
267
ConnectionArn : !Sub arn:aws:codestar-connections:us-east-1:${AWS::AccountId}:connection/${CodeStarConnectionResourceId}
262
268
FullRepositoryId : !Sub ${GitHubOwner}/${GitHubRepo}
263
269
BranchName : !Ref GitHubBranch
264
- DetectChanges : true
265
270
266
271
- Name : Build
267
272
Actions :
@@ -290,42 +295,106 @@ Resources:
290
295
OutputArtifacts :
291
296
- Name : appBuildResults
292
297
293
- - Name : Deploy_To_Test
294
- Actions :
295
- - Name : app-deploy
296
- ActionTypeId :
297
- Category : Deploy
298
- Owner : AWS
299
- Version : 1
300
- Provider : CloudFormation
301
- InputArtifacts :
302
- - Name : appBuildResults
303
- Configuration :
304
- StackName : !If [TargetsMainBranch, "javabuilder-test", !Sub "javabuilder-${GitHubBranch}-test"]
305
- ActionMode : CREATE_UPDATE
306
- TemplatePath : appBuildResults::packaged-app-template.yml
307
- TemplateConfiguration : appBuildResults::cicd/3-app/javabuilder/test.config.json
308
- Capabilities : CAPABILITY_AUTO_EXPAND
309
- RoleArn : !Sub arn:aws:iam::${AWS::AccountId}:role/admin/CloudFormationService
298
+ - !If
299
+ - DeployToAdhoc
300
+ - Name : Deploy_To_Adhoc
301
+ Actions :
302
+ - Name : app-deploy
303
+ ActionTypeId :
304
+ Category : Deploy
305
+ Owner : AWS
306
+ Version : 1
307
+ Provider : CloudFormation
308
+ InputArtifacts :
309
+ - Name : appBuildResults
310
+ Configuration :
311
+ StackName : !Sub "javabuilder-adhoc-${GitHubBranch}"
312
+ ActionMode : CREATE_UPDATE
313
+ TemplatePath : appBuildResults::packaged-app-template.yml
314
+ TemplateConfiguration : appBuildResults::cicd/3-app/javabuilder/adhoc.config.json
315
+ ParameterOverrides : !Join
316
+ - ' '
317
+ - - '{ "SubDomainName" : " '
318
+ - !Sub " javabuilder-adhoc-${GitHubBranch}"
319
+ - ' " }'
320
+ Capabilities : CAPABILITY_AUTO_EXPAND
321
+ RoleArn : !Sub arn:aws:iam::${AWS::AccountId}:role/admin/CloudFormationService
322
+ - !Ref AWS::NoValue
310
323
311
- - Name : Integration_Test
312
- Actions :
313
- - Name : integration-test
314
- ActionTypeId :
315
- Category : Build
316
- Owner : AWS
317
- Provider : CodeBuild
318
- Version : 1
319
- InputArtifacts :
320
- - Name : sourceCode
321
- Configuration :
322
- ProjectName : !Ref IntegrationTestBuildProject
323
- EnvironmentVariables : !Sub
324
- - ' [{"name":"APP_SUBDOMAIN","value":"${SUBDOMAIN}","type":"PLAINTEXT"},{"name":"APP_BASE_DOMAIN","value":"${BASE_DOMAIN}","type":"PLAINTEXT"}]'
325
- - BASE_DOMAIN : code.org
326
- SUBDOMAIN : !If [TargetsMainBranch, "javabuilder-test", !Sub "javabuilder-${GitHubBranch}-test"]
327
- OutputArtifacts :
328
- - Name : integrationTestResultsPOC
324
+ - !If
325
+ - DeployToTestAndProd
326
+ - Name : Deploy_To_Test
327
+ Actions :
328
+ - Name : app-deploy
329
+ ActionTypeId :
330
+ Category : Deploy
331
+ Owner : AWS
332
+ Version : 1
333
+ Provider : CloudFormation
334
+ InputArtifacts :
335
+ - Name : appBuildResults
336
+ Configuration :
337
+ StackName : !If [TargetsMainBranch, "javabuilder-test", !Sub "javabuilder-${GitHubBranch}-test"]
338
+ ActionMode : CREATE_UPDATE
339
+ TemplatePath : appBuildResults::packaged-app-template.yml
340
+ TemplateConfiguration : appBuildResults::cicd/3-app/javabuilder/test.config.json
341
+ ParameterOverrides : !Join
342
+ - ' '
343
+ - - '{ "SubDomainName" : " '
344
+ - !If [ TargetsMainBranch, 'javabuilder-test', !Sub 'javabuilder-${GitHubBranch}-test' ]
345
+ - '" }'
346
+ Capabilities : CAPABILITY_AUTO_EXPAND
347
+ RoleArn : !Sub arn:aws:iam::${AWS::AccountId}:role/admin/CloudFormationService
348
+ - !Ref AWS::NoValue
349
+
350
+ - !If
351
+ - DeployToTestAndProd
352
+ - Name : Integration_Test
353
+ Actions :
354
+ - Name : integration-test
355
+ ActionTypeId :
356
+ Category : Build
357
+ Owner : AWS
358
+ Provider : CodeBuild
359
+ Version : 1
360
+ InputArtifacts :
361
+ - Name : sourceCode
362
+ Configuration :
363
+ ProjectName : !Ref IntegrationTestBuildProject
364
+ EnvironmentVariables : !Sub
365
+ - ' [{"name":"APP_SUBDOMAIN","value":"${SUBDOMAIN}","type":"PLAINTEXT"},{"name":"APP_BASE_DOMAIN","value":"${BASE_DOMAIN}","type":"PLAINTEXT"}]'
366
+ - BASE_DOMAIN : code.org
367
+ SUBDOMAIN : !If [TargetsMainBranch, "javabuilder-test", !Sub "javabuilder-${GitHubBranch}-test"]
368
+ OutputArtifacts :
369
+ - Name : integrationTestResultsPOC
370
+ - !Ref AWS::NoValue
371
+
372
+ - !If
373
+ - DeployToTestAndProd
374
+ - Name : Deploy_To_Production
375
+ Actions :
376
+ - Name : app-deploy
377
+ ActionTypeId :
378
+ Category : Deploy
379
+ Owner : AWS
380
+ Version : 1
381
+ Provider : CloudFormation
382
+ InputArtifacts :
383
+ - Name : appBuildResults
384
+ # The value of `Configuration` must be an object with String (or simple type) properties
385
+ Configuration :
386
+ StackName : !If [TargetsMainBranch, "javabuilder", !Sub "javabuilder-${GitHubBranch}"]
387
+ ActionMode : CREATE_UPDATE
388
+ TemplatePath : appBuildResults::packaged-app-template.yml
389
+ TemplateConfiguration : appBuildResults::cicd/3-app/javabuilder/production.config.json
390
+ ParameterOverrides : !Join
391
+ - ' '
392
+ - - '{ "SubDomainName" : " '
393
+ - !If [ TargetsMainBranch, 'javabuilder', !Sub 'javabuilder-${GitHubBranch}' ]
394
+ - '" }'
395
+ Capabilities : CAPABILITY_AUTO_EXPAND
396
+ RoleArn : !Sub arn:aws:iam::${AWS::AccountId}:role/admin/CloudFormationService
397
+ - !Ref AWS::NoValue
329
398
330
399
# Send pipeline events to an SNS topic.
331
400
# Note: Integration with Slack via AWS ChatBot is configured manually via AWS Console.
0 commit comments