This repository has been archived by the owner on Aug 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaws-ci-cd-master-stack.yml
219 lines (213 loc) · 11.1 KB
/
aws-ci-cd-master-stack.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
AWSTemplateFormatVersion: "2010-09-09"
Description: Master stack for CI/CD using CodePipeline
Parameters:
S3BucketCodeBuild:
Description: S3 Bucket name for cloudformation template for AWS CodeBuild
Type: String
Default: reciter-workshop
S3KeyCodeBuild:
Description: S3 Key for cloudformation template for AWS CodeBuild
Type: String
Default: CodeBuild.yml
S3BucketCodePipeline:
Description: S3 Bucket name for cloudformation template for AWS CodePipeline
Type: String
Default: reciter-workshop
S3KeyCodePipeline:
Description: S3 Key for cloudformation template for AWS CodePipeline
Type: String
Default: CodePipeline.yml
ReciterPipelineName:
AllowedPattern: "^[a-zA-Z0-9-_]*$"
Description: "Name to give the CodePipeline Project. For this sample, use the same name as your repository."
MaxLength: "255"
MinLength: "2"
Type: String
Default: ReCiter
ReciterPubmedPipelineName:
AllowedPattern: "^[a-zA-Z0-9-_]*$"
Description: "Name to give the CodePipeline Project. For this sample, use the same name as your repository."
MaxLength: "255"
MinLength: "2"
Type: String
Default: ReCiterPubmed
ReciterScopusPipelineName:
AllowedPattern: "^[a-zA-Z0-9-_]*$"
Description: "Name to give the CodePipeline Project. For this sample, use the same name as your repository."
MaxLength: "255"
MinLength: "2"
Type: String
Default: ReCiterScopus
ReciterPubManagerPipelineName:
AllowedPattern: "^[a-zA-Z0-9-_]*$"
Description: "Name to give the CodePipeline Project. For this sample, use the same name as your repository."
MaxLength: "255"
MinLength: "2"
Type: String
Default: ReCiterPubManager
GitHubUser:
Description: "GitHub UserName"
Type: String
Default: sarbajitdutta
GitHubBranch:
Description: "Branch to use from Repo. Only the Name. not the URL"
Type: String
Default: master
ReciterGitHubRepo:
Description: "GitHub Repo to pull from. Only the Name. not the URL"
Type: String
Default: ReCiter
ReciterPubmedGitHubRepo:
Description: "GitHub Repo to pull from. Only the Name. not the URL"
Type: String
Default: ReCiter-PubMed-Retrieval-Tool
ReciterScopusGitHubRepo:
Description: "GitHub Repo to pull from. Only the Name. not the URL"
Type: String
Default: ReCiter-Scopus-Retrieval-Tool
ReciterPubManagerGitHubRepo:
Description: "GitHub Repo to pull from. Only the Name. not the URL"
Type: String
Default: ReCiter-Publication-Manager
GitHubToken:
Description: "Secret. It might look something like 9b189a1654643522561f7b3ebd44a1531a4287af OAuthToken with access to Repo. Go to https://github.com/settings/tokens"
Type: String
NoEcho: true
ReciterCodeBuildProjectName:
Description: "CodeBuild project name to be used in the build process of pipeline"
Type: String
Default: ReCiter
ReciterPubmedCodeBuildProjectName:
Description: "CodeBuild project name to be used in the build process of pipeline"
Type: String
Default: ReCiter-Pubmed
ReciterScopusCodeBuildProjectName:
Description: "CodeBuild project name to be used in the build process of pipeline"
Type: String
Default: ReCiter-Scopus
ReciterPubManagerCodeBuildProjectName:
Description: "CodeBuild project name to be used in the build process of pipeline"
Type: String
Default: ReCiter-Publication-Manager
ReciterDeployBeanstalkAppName:
Description: "ElasticBeanstalk application name to be used in the deploy process of pipeline"
Type: String
Default: ReCiterService
ReciterPubmedDeployBeanstalkAppName:
Description: "ElasticBeanstalk application name to be used in the deploy process of pipeline"
Type: String
Default: ReCiterPubmedService
ReciterScopusDeployBeanstalkAppName:
Description: "ElasticBeanstalk application name to be used in the deploy process of pipeline"
Type: String
Default: ReCiterScopusService
ReciterPubManagerDeployBeanstalkAppName:
Description: "ElasticBeanstalk application name to be used in the deploy process of pipeline"
Type: String
Default: ReCiterPublicationManagerService
ReciterDeployBeanstalkEnvName:
Description: "ElasticBeanstalk environment name to be used in the deploy process of pipeline"
Type: String
Default: ReCiterService-env
ReciterPubmedDeployBeanstalkEnvName:
Description: "ElasticBeanstalk environment name to be used in the deploy process of pipeline"
Type: String
Default: ReCiterPubmedService-env
ReciterScopusDeployBeanstalkEnvName:
Description: "ElasticBeanstalk environment name to be used in the deploy process of pipeline"
Type: String
Default: ReCiterScopusService-env
ReciterPubManagerDeployBeanstalkEnvName:
Description: "ElasticBeanstalk environment name to be used in the deploy process of pipeline"
Type: String
Default: ReCiterPublicationManagerService-env
Resources:
CIRoleStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3.amazonaws.com/reciter-workshop/aws-ci-roles.yml
ReCiterPipeline:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Sub https://s3.amazonaws.com/${S3BucketCodePipeline}/${S3KeyCodePipeline}
Parameters:
BuildImage: aws/codebuild/standard:3.0
ProjectName: !Ref ReciterCodeBuildProjectName
RepositoryUrl: !Sub https://github.com/${GitHubUser}/${ReciterGitHubRepo}.git
S3Bucket: !Ref S3BucketCodeBuild
S3Key: !Ref S3KeyCodeBuild
ArtifactStoreBucket: !GetAtt CIRoleStack.Outputs.CodePipelineS3BucketName
PipelineName: !Ref ReciterPipelineName
GitHubUser: !Ref GitHubUser
GitHubRepo: !Ref ReciterGitHubRepo
GitHubBranch: !Ref GitHubBranch
GitHubToken: !Ref GitHubToken
DeployBeanstalkAppName: !Ref ReciterDeployBeanstalkAppName
DeployBeanstalkEnvName: !Ref ReciterDeployBeanstalkEnvName
CodePipelineServiceRole: !GetAtt CIRoleStack.Outputs.CodePipelineRoleNameArn
ReCiterPubmedPipeline:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Sub https://s3.amazonaws.com/${S3BucketCodePipeline}/${S3KeyCodePipeline}
Parameters:
BuildImage: aws/codebuild/standard:3.0
ProjectName: !Ref ReciterPubmedCodeBuildProjectName
RepositoryUrl: !Sub https://github.com/${GitHubUser}/${ReciterPubmedGitHubRepo}.git
S3Bucket: !Ref S3BucketCodeBuild
S3Key: !Ref S3KeyCodeBuild
ArtifactStoreBucket: !GetAtt CIRoleStack.Outputs.CodePipelineS3BucketName
PipelineName: !Ref ReciterPubmedPipelineName
GitHubUser: !Ref GitHubUser
GitHubRepo: !Ref ReciterPubmedGitHubRepo
GitHubBranch: !Ref GitHubBranch
GitHubToken: !Ref GitHubToken
DeployBeanstalkAppName: !Ref ReciterPubmedDeployBeanstalkAppName
DeployBeanstalkEnvName: !Ref ReciterPubmedDeployBeanstalkEnvName
CodePipelineServiceRole: !GetAtt CIRoleStack.Outputs.CodePipelineRoleNameArn
ReCiterScopusPipeline:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Sub https://s3.amazonaws.com/${S3BucketCodePipeline}/${S3KeyCodePipeline}
Parameters:
BuildImage: aws/codebuild/standard:3.0
ProjectName: !Ref ReciterScopusCodeBuildProjectName
RepositoryUrl: !Sub https://github.com/${GitHubUser}/${ReciterScopusGitHubRepo}.git
S3Bucket: !Ref S3BucketCodeBuild
S3Key: !Ref S3KeyCodeBuild
ArtifactStoreBucket: !GetAtt CIRoleStack.Outputs.CodePipelineS3BucketName
PipelineName: !Ref ReciterScopusPipelineName
GitHubUser: !Ref GitHubUser
GitHubRepo: !Ref ReciterScopusGitHubRepo
GitHubBranch: !Ref GitHubBranch
GitHubToken: !Ref GitHubToken
DeployBeanstalkAppName: !Ref ReciterScopusDeployBeanstalkAppName
DeployBeanstalkEnvName: !Ref ReciterScopusDeployBeanstalkEnvName
CodePipelineServiceRole: !GetAtt CIRoleStack.Outputs.CodePipelineRoleNameArn
ReCiterPubManagerPipeline:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Sub https://s3.amazonaws.com/${S3BucketCodePipeline}/${S3KeyCodePipeline}
Parameters:
BuildImage: aws/codebuild/standard:3.0
ProjectName: !Ref ReciterPubManagerCodeBuildProjectName
RepositoryUrl: !Sub https://github.com/${GitHubUser}/${ReciterPubManagerGitHubRepo}.git
S3Bucket: !Ref S3BucketCodeBuild
S3Key: !Ref S3KeyCodeBuild
ArtifactStoreBucket: !GetAtt CIRoleStack.Outputs.CodePipelineS3BucketName
PipelineName: !Ref ReciterPubManagerPipelineName
GitHubUser: !Ref GitHubUser
GitHubRepo: !Ref ReciterPubManagerGitHubRepo
GitHubBranch: !Ref GitHubBranch
GitHubToken: !Ref GitHubToken
DeployBeanstalkAppName: !Ref ReciterPubManagerDeployBeanstalkAppName
DeployBeanstalkEnvName: !Ref ReciterPubManagerDeployBeanstalkEnvName
CodePipelineServiceRole: !GetAtt CIRoleStack.Outputs.CodePipelineRoleNameArn
Outputs:
ReCiterProjectName:
Value: !Ref ReCiterPipeline
ReCiterPubmedProjectName:
Value: !Ref ReCiterPubmedPipeline
ReCiterScopusProjectName:
Value: !Ref ReCiterScopusPipeline
ReCiterPubManagerProjectName:
Value: !Ref ReCiterPubManagerPipeline