-
Notifications
You must be signed in to change notification settings - Fork 4
/
pipeline.yml
120 lines (120 loc) · 3.57 KB
/
pipeline.yml
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
Parameters:
SourcePath:
Type: String
Description: Build artifact path to upload to S3
Default: ""
DestPath:
Type: String
Description: Build artifact path to upload to S3
Default: "/"
Conditions:
HasSourcePath:
"Fn::Not":
- "Fn::Equals":
- ""
- Ref: SourcePath
Resources:
DeployAcceptanceSite:
Type: AWS::CodeBuild::Project
Condition: IsAcptEnabled
Properties:
Name:
Fn::Sub: ${Namespace}-pipeline-${ServiceName}-deploy-site-acceptance
EncryptionKey:
Ref: CodePipelineKeyArn
Description: Deploy site to acpt environment
ServiceRole:
Ref: CodeBuildCDAcptRoleArn
Artifacts:
Type: CODEPIPELINE
Environment:
Type:
Ref: MuType
ComputeType:
Ref: MuComputeType
Image:
Ref: MuImage
Source:
Type: CODEPIPELINE
BuildSpec:
Fn::Sub: |
version: 0.2
phases:
build:
commands:
- aws s3 sync ${SourcePath}/ s3://${Namespace}-loadbalancer-${AcptEnv}-${AWS::Region}-${AWS::AccountId}${DestPath}
DeployProductionSite:
Type: AWS::CodeBuild::Project
Condition: IsProdEnabled
Properties:
Name:
Fn::Sub: ${Namespace}-pipeline-${ServiceName}-deploy-site-production
EncryptionKey:
Ref: CodePipelineKeyArn
Description: Deploy site to prod environment
ServiceRole:
Ref: CodeBuildCDProdRoleArn
Artifacts:
Type: CODEPIPELINE
Environment:
Type:
Ref: MuType
ComputeType:
Ref: MuComputeType
Image:
Ref: MuImage
Source:
Type: CODEPIPELINE
BuildSpec:
Fn::Sub: |
version: 0.2
phases:
build:
commands:
- aws s3 --delete sync ${SourcePath}/ s3://${Namespace}-loadbalancer-${ProdEnv}-${AWS::Region}-${AWS::AccountId}${DestPath}
Pipeline:
Properties:
Stages:
Fn::Splice:
- 2
- 2
- - Fn::If:
Fn::Splice:
- 1
- 1
- - Actions:
- Fn::If:
- HasSourcePath
- Name: DeploySite
ActionTypeId:
Category: Test
Owner: AWS
Version: '1'
Provider: CodeBuild
InputArtifacts:
- Name: ArtifactOutput
Configuration:
ProjectName:
Ref: DeployAcceptanceSite
RunOrder: 15
- Ref: AWS::NoValue
- Fn::If:
Fn::Splice:
- 1
- 1
- - Actions:
- Fn::If:
- HasSourcePath
- Name: DeploySite
ActionTypeId:
Category: Test
Owner: AWS
Version: '1'
Provider: CodeBuild
InputArtifacts:
- Name: ArtifactOutput
Configuration:
ProjectName:
Ref: DeployProductionSite
RunOrder: 15
- Ref: AWS::NoValue