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