-
Notifications
You must be signed in to change notification settings - Fork 13
/
codebuild-ci.yaml
83 lines (79 loc) · 2.82 KB
/
codebuild-ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
AWSTemplateFormatVersion: "2010-09-09"
Description: Manage GitHub Continuous Integration and Release processes
Parameters:
GitHubRepositoryName:
Type: String
Description: GitHub Repo Name For aws-cloudformation-resource-providers-redshift
GitHubRepositoryShortName:
Type: String
Description: Short Name for this provider to avoid exceeding the 64char limit on IAM Resources
CFNSDKBucket:
Type: String
Description: S3 Location of CloudFormation SDK; should be removed when we can publish the latest client
Resources:
AWSCloudFormationResourceProviderCIPolicy:
Type: AWS::IAM::ManagedPolicy
Properties:
ManagedPolicyName: !Sub "codebuild-${GitHubRepositoryName}-ci-policy"
Path: /service-role/
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- logs:CreateLogGroup
- logs:CreateLogStream
- logs:PutLogEvents
Resource:
- !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/codebuild/${GitHubRepositoryName}-ci"
- !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/codebuild/${GitHubRepositoryName}-ci:*"
- Effect: Allow
Action:
- s3:PutObject
- s3:GetObject
- s3:GetObjectVersion
Resource: !Sub "${CFNSDKBucket}/*"
- Effect: Allow
Action:
- s3:ListBucket
Resource: !Ref CFNSDKBucket
AWSCloudFormationResourceProviderCIRole:
Type: AWS::IAM::Role
Properties:
RoleName: !Sub "codebuild-${GitHubRepositoryShortName}-ci"
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service: codebuild.amazonaws.com
Action: sts:AssumeRole
Path: /service-role/
ManagedPolicyArns:
- !Ref AWSCloudFormationResourceProviderCIPolicy
AWSCloudFormationResourceProviderCIProject:
Type: AWS::CodeBuild::Project
Properties:
Name: !Sub "${GitHubRepositoryName}-ci"
Description: !Sub "https://github.com/aws-cloudformation/${GitHubRepositoryName}/"
BadgeEnabled: true
TimeoutInMinutes: 30
Artifacts:
Type: NO_ARTIFACTS
Environment:
Type: LINUX_CONTAINER
ComputeType: BUILD_GENERAL1_SMALL
Image: aws/codebuild/standard:2.0
PrivilegedMode: false
Source:
Type: GITHUB
Auth:
Type: OAUTH
InsecureSsl: false
Location: !Sub "https://github.com/aws-cloudformation/${GitHubRepositoryName}.git"
ReportBuildStatus: true
GitCloneDepth: 1
BuildSpec: buildspec.yml
ServiceRole: !GetAtt AWSCloudFormationResourceProviderCIRole.Arn
Triggers:
Webhook: true