· 7 years ago · Jul 21, 2018, 05:56 PM
1CodePipeline:
2 Type: 'AWS::CodePipeline::Pipeline'
3 Properties:
4 RoleArn: !GetAtt CodePipeLineRole.Arn
5 ArtifactStore:
6 Location: !Ref PipelineBucket
7 Type: S3
8 Stages:
9 -
10 Name: Source
11 Actions:
12 -
13 Name: SourceAction
14 ActionTypeId:
15 Category: Source
16 Owner: ThirdParty
17 Provider: GitHub
18 Version: 1
19 OutputArtifacts:
20 -
21 Name: MyApp
22 Configuration:
23 Owner: !Ref GithubOwner
24 Repo: !Ref GithubRepo
25 Branch: master
26 OAuthToken: !Ref GithubOAuthToken
27 -
28 Name: Build
29 Actions:
30 -
31 Name: BuildAction
32 ActionTypeId:
33 Category: Build
34 Owner: AWS
35 Version: 1
36 Provider: CodeBuild
37 InputArtifacts:
38 -
39 Name: MyApp
40 OutputArtifacts:
41 -
42 Name: MyAppBuild
43 Configuration:
44 ProjectName: !Ref CodeBuild
45CodePipeLineRole:
46 Type: AWS::IAM::Role
47 Properties:
48 AssumeRolePolicyDocument:
49 Version: "2012-10-17"
50 Statement:
51 -
52 Effect: Allow
53 Principal:
54 Service:
55 - "codepipeline.amazonaws.com"
56 Action:
57 - "sts:AssumeRole"
58 Policies:
59 - PolicyName: root
60 PolicyDocument:
61 Version: "2012-10-17"
62 Statement:
63 -
64 Effect: Allow
65 Action:
66 - "s3:GetObject"
67 - "s3:GetObjectVersion"
68 - "s3:GetBucketVersioning"
69 - "s3:PutObject"
70 Resource:
71 - !GetAtt PipelineBucket.Arn
72 - !Join ['', [!GetAtt PipelineBucket.Arn, "/*"]]
73 -
74 Effect: Allow
75 Action:
76 - "codebuild:BatchGetBuilds"
77 - "codebuild:StartBuild"
78 Resource: "*"
79# Temp bucket for storing build artifacts
80PipelineBucket:
81 Type: 'AWS::S3::Bucket'
82 Properties: {}