-
Notifications
You must be signed in to change notification settings - Fork 428
/
Copy pathbuildspec_e2e.yml
289 lines (286 loc) · 10.6 KB
/
buildspec_e2e.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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
version: 0.2
env:
secrets-manager:
DOCKERHUB_USERNAME: prod/ecs-cicd-bot/dockerhub-account-info:username
DOCKERHUB_TOKEN: prod/ecs-cicd-bot/dockerhub-token:dockerhub-token
IMPORTED_CERT_ARN: e2e/account/import_certs:cert_arn
# We increased the number of VPCs limit to 15 from 5 in the e2e test's app account/region pair.
# If the number of tests running in a region is larger than 15, this comment should be updated.
batch:
fast-fail: false
build-graph:
- identifier: addons
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: addons
APP_REGION: us-west-2
APP_ACCOUNT: e2e/account/addons
TESTENV_REGION: us-west-2
TESTENV_ACCOUNT: e2e/account/addons
- identifier: customized_env
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: customized-env
APP_REGION: us-west-1
APP_ACCOUNT: e2e/account/customized_env
TESTENV_REGION: us-west-1
TESTENV_ACCOUNT: e2e/account/customized_env
PRODENV_REGION: us-west-1
PRODENV_ACCOUNT: e2e/account/customized_env
SHAREDENV_REGION: us-west-1
SHAREDENV_ACCOUNT: e2e/account/customized_env
- identifier: init
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: init
APP_REGION: us-east-1
APP_ACCOUNT: e2e/account/init
- identifier: multi_env_app
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: multi-env-app
APP_REGION: us-east-2
APP_ACCOUNT: e2e/account/multi_env_app
TESTENV_REGION: us-west-1
TESTENV_ACCOUNT: e2e/account/multi_env_app/test
PRODENV_REGION: us-east-1
PRODENV_ACCOUNT: e2e/account/multi_env_app/prod
- identifier: multi_svc_app
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: multi-svc-app
APP_REGION: us-west-2
APP_ACCOUNT: e2e/account/multi_svc_app
TESTENV_REGION: us-west-2
TESTENV_ACCOUNT: e2e/account/multi_svc_app
- identifier: root
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: root
APP_REGION: us-west-1
- identifier: sidecars
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: sidecars
APP_REGION: us-east-1
APP_ACCOUNT: e2e/account/sidecars
TESTENV_REGION: us-east-1
TESTENV_ACCOUNT: e2e/account/sidecars
- identifier: task
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: task
APP_REGION: us-east-2
APP_ACCOUNT: e2e/account/task
TESTENV_REGION: us-east-2
TESTENV_ACCOUNT: e2e/account/task
- identifier: app_with_domain
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: app-with-domain
APP_REGION: us-west-2
APP_ACCOUNT: e2e/account/app_with_domains
TESTENV_REGION: us-west-2
TESTENV_ACCOUNT: e2e/account/app_with_domains
PRODENV_REGION: us-east-1
PRODENV_ACCOUNT: e2e/account/app_with_domains/prod
- identifier: import_certs
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: import-certs
APP_REGION: us-west-2
APP_ACCOUNT: e2e/account/import_certs
TESTENV_REGION: us-west-2
TESTENV_ACCOUNT: e2e/account/import_certs
- identifier: isolated
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: isolated
APP_REGION: us-west-2
APP_ACCOUNT: e2e/account/isolated
TESTENV_REGION: us-west-2
TESTENV_ACCOUNT: e2e/account/isolated
- identifier: exec
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: exec
APP_REGION: ap-northeast-1
APP_ACCOUNT: e2e/account/exec
TESTENV_REGION: ap-northeast-1
TESTENV_ACCOUNT: e2e/account/exec
- identifier: apprunner
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: apprunner
APP_REGION: ap-northeast-1
APP_ACCOUNT: e2e/account/apprunner
- identifier: pipeline
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: pipeline
APP_REGION: eu-west-1
APP_ACCOUNT: e2e/account/pipeline
TESTENV_REGION: eu-west-1
TESTENV_ACCOUNT: e2e/account/pipeline/test
PRODENV_REGION: eu-central-1
PRODENV_ACCOUNT: e2e/account/pipeline/prod
- identifier: multi_pipeline
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: multi-pipeline
APP_REGION: ap-northeast-1
APP_ACCOUNT: e2e/account/multi_pipeline
TESTENV_REGION: ap-northeast-1
TESTENV_ACCOUNT: e2e/account/multi_pipeline/test
PRODENV_REGION: ap-southeast-1
PRODENV_ACCOUNT: e2e/account/multi_pipeline/prod
- identifier: worker
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: worker
APP_REGION: eu-central-1
APP_ACCOUNT: e2e/account/worker
TESTENV_REGION: eu-central-1
TESTENV_ACCOUNT: e2e/account/worker
- identifier: cloudfront
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: cloudfront
APP_REGION: eu-central-1
APP_ACCOUNT: e2e/account/cloudfront
TESTENV_REGION: eu-central-1
TESTENV_ACCOUNT: e2e/account/cloudfront
- identifier: static_site
env:
privileged-mode: true
type: LINUX_CONTAINER
compute-type: BUILD_GENERAL1_LARGE
image: aws/codebuild/standard:7.0
variables:
TEST_SUITE: static-site
APP_REGION: eu-central-1
APP_ACCOUNT: e2e/account/static_site
TESTENV_REGION: eu-central-1
TESTENV_ACCOUNT: e2e/account/static_site
phases:
install:
commands:
- "cd $HOME/.goenv && git pull --ff-only && cd -"
- "goenv install 1.21.1"
- "goenv global 1.21.1"
pre_build:
commands:
- printenv DOCKERHUB_TOKEN | docker login --username ${DOCKERHUB_USERNAME} --password-stdin
build:
commands:
- cd $CODEBUILD_SRC_DIR
- export GOPATH=/go
- rm -rf cf-custom-resources/node_modules
- mkdir -p /tmp/.aws
- account=$(aws secretsmanager get-secret-value --secret-id ${APP_ACCOUNT} | jq '.SecretString' -r)
- printf "[default]\nregion = $APP_REGION\n" > /tmp/.aws/config
- printf "[default]\n" >> /tmp/.aws/credentials
- printf "aws_access_key_id=$(echo $account | jq '.access_key' -r)\n" >> /tmp/.aws/credentials
- printf "aws_secret_access_key=$(echo $account | jq '.secret_access_key' -r)\n\n" >> /tmp/.aws/credentials
- |
if [ ! -z "$TESTENV_REGION" ]; then
account=$(aws secretsmanager get-secret-value --secret-id ${TESTENV_ACCOUNT} | jq '.SecretString' -r)
printf "[profile test]\nregion=$TESTENV_REGION\n" >> /tmp/.aws/config
printf "[test]\n" >> /tmp/.aws/credentials
printf "aws_access_key_id=$(echo $account | jq '.access_key' -r)\n" >> /tmp/.aws/credentials
printf "aws_secret_access_key=$(echo $account | jq '.secret_access_key' -r)\n\n" >> /tmp/.aws/credentials
fi
- |
if [ ! -z "$PRODENV_REGION" ]; then
account=$(aws secretsmanager get-secret-value --secret-id ${PRODENV_ACCOUNT} | jq '.SecretString' -r)
printf "[profile prod]\nregion=$PRODENV_REGION\n" >> /tmp/.aws/config
printf "[prod]\n" >> /tmp/.aws/credentials
printf "aws_access_key_id=$(echo $account | jq '.access_key' -r)\n" >> /tmp/.aws/credentials
printf "aws_secret_access_key=$(echo $account | jq '.secret_access_key' -r)\n\n" >> /tmp/.aws/credentials
fi
- |
if [ ! -z "$SHAREDENV_REGION" ]; then
account=$(aws secretsmanager get-secret-value --secret-id ${SHAREDENV_ACCOUNT} | jq '.SecretString' -r)
printf "[profile shared]\nregion=$SHAREDENV_REGION\n" >> /tmp/.aws/config
printf "[shared]\n" >> /tmp/.aws/credentials
printf "aws_access_key_id=$(echo $account | jq '.access_key' -r)\n" >> /tmp/.aws/credentials
printf "aws_secret_access_key=$(echo $account | jq '.secret_access_key' -r)\n\n" >> /tmp/.aws/credentials
fi
- sed -i -e '$s/$/ --noColor/' e2e/e2e.sh
- make build-e2e
- docker build -t copilot-cli/e2e . -f e2e/Dockerfile
- >
docker run --privileged -v /tmp/.aws:/home/.aws -e "HOME=/home"
-e "TEST_SUITE=$TEST_SUITE"
-e "DOCKERHUB_USERNAME=$DOCKERHUB_USERNAME"
-e "DOCKERHUB_TOKEN=$DOCKERHUB_TOKEN"
-e "IMPORTED_CERT_ARN=$IMPORTED_CERT_ARN"
copilot-cli/e2e:latest