forked from linode/manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
214 lines (192 loc) · 7.3 KB
/
docker-compose.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
---
version: '3.4'
# Environment variables that will be exposed to every Cypress runner.
x-e2e-env:
&default-env
# CI build information for Cypress Dashboard.
BUILD_ID: "${GIT_BRANCH}-${BUILD_NUMBER}"
BUILD_NUMBER: ${BUILD_NUMBER}
BUILD_URL: ${BUILD_URL}
# Exposing `COMMIT_INFO_*` environment variables to Cypress allows us to
# manually specify git commit information. This is required because Cypress
# cannot retrieve the information automatically from within the container due
# to file ownership differences.
#
# See also:
# - https://github.com/cypress-io/commit-info
# - https://github.blog/2022-04-18-highlights-from-git-2-36/#stricter-repository-ownership-checks
COMMIT_INFO_AUTHOR: ${COMMIT_INFO_AUTHOR}
COMMIT_INFO_BRANCH: ${CHANGE_BRANCH}
COMMIT_INFO_EMAIL: ${COMMIT_INFO_EMAIL}
COMMIT_INFO_MESSAGE: ${COMMIT_INFO_MESSAGE}
COMMIT_INFO_REMOTE: ${GIT_URL}
COMMIT_INFO_SHA: ${GIT_COMMIT}
# Cypress environment variables for run environment and CI configuration.
CYPRESS_BASE_URL: ${CYPRESS_BASE_URL}
CYPRESS_PULL_REQUEST_ID: ${CHANGE_ID}
CYPRESS_PULL_REQUEST_URL: ${CHANGE_URL}
CYPRESS_RECORD: ${CYPRESS_RECORD}
CYPRESS_RECORD_KEY: ${CYPRESS_RECORD_KEY}
# Cloud Manager-specific test configuration.
CY_TEST_SUITE: ${CY_TEST_SUITE}
CY_TEST_REGION: ${CY_TEST_REGION}
CY_TEST_FEATURE_FLAGS: ${CY_TEST_FEATURE_FLAGS}
CY_TEST_TAGS: ${CY_TEST_TAGS}
CY_TEST_DISABLE_RETRIES: ${CY_TEST_DISABLE_RETRIES}
# Cypress environment variables for alternative parallelization.
CY_TEST_SPLIT_RUN: ${CY_TEST_SPLIT_RUN}
CY_TEST_SPLIT_RUN_TOTAL: ${CY_TEST_SPLIT_RUN_TOTAL}
CY_TEST_SPLIT_RUN_INDEX: ${CY_TEST_SPLIT_RUN_INDEX}
# Cypress performance.
CY_TEST_ACCOUNT_CACHE_DIR: ${CY_TEST_ACCOUNT_CACHE_DIR}
# Cypress reporting.
CY_TEST_JUNIT_REPORT: ${CY_TEST_JUNIT_REPORT}
CY_TEST_USER_REPORT: ${CY_TEST_USER_REPORT}
# Cloud Manager build environment.
HOME: /home/node
REACT_APP_API_ROOT: ${REACT_APP_API_ROOT}
REACT_APP_CLIENT_ID: ${REACT_APP_CLIENT_ID}
REACT_APP_DISABLE_NEW_RELIC: ${REACT_APP_DISABLE_NEW_RELIC}
REACT_APP_LAUNCH_DARKLY_ID: ${REACT_APP_LAUNCH_DARKLY_ID}
REACT_APP_LOGIN_ROOT: ${REACT_APP_LOGIN_ROOT}
# Miscellaneous Jenkins vars.
HUDSON_HOME: ${HUDSON_HOME}
HUDSON_URL: ${HUDSON_URL}
# Volumes that will be exposed to every end-to-end Cypress runner.
x-e2e-volumes:
&default-volumes
- ./.git:/home/node/app/.git
- ./cache:/home/node/app/cache
- ./packages:/home/node/app/packages
- ./package.json:/home/node/app/package.json
- ./node_modules:/home/node/app/node_modules
# Base Docker Compose service config for each Cypress runner.
# This can be extended/overridden on a per-runner basis for e.g.container name
# and OAuth token.
x-e2e-runners:
&default-runner
build:
context: .
dockerfile: ./packages/manager/Dockerfile
target: e2e
env_file: ./packages/manager/.env
volumes: *default-volumes
entrypoint: 'yarn'
services:
# Serves a local instance of Cloud Manager for Cypress to use for its tests.
# Not all of the runner containers require a local instance of Cypress, but
# this service can be used in all cases.
web:
build:
context: .
dockerfile: ./packages/manager/Dockerfile
target: manager
ports:
- "3000"
volumes:
- ./packages/manager:/home/node/app/packages/manager
- ./package.json:/home/node/app/package.json
- ./node_modules:/home/node/app/node_modules
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000']
interval: 15s
timeout: 10s
retries: 10
# Cypress test runner service to run tests against a remotely-served Cloud instance.
#
# This is useful when testing against a standard Cloud Manager environment,
# like Production at cloud.linode.com, but can also be used to run tests against
# pre-Prod environments, PR preview links, and more.
cypress_remote:
<<: *default-runner
environment:
<<: *default-env
MANAGER_OAUTH: ${MANAGER_OAUTH}
# Cypress test runner service to run tests against a local Cloud instance.
#
# This is useful when testing against a Cloud Manager instance served locally at
# `localhost:3000`, e.g. during development.
#
# If the local Cloud Manager instance is not served at `localhost:3000` (when
# served from a container, for example), prefer the `cypress_containerized`
# service instead.
cypress_local:
<<: *default-runner
environment:
<<: *default-env
MANAGER_OAUTH: ${MANAGER_OAUTH}
depends_on:
web:
condition: service_healthy
# Cypress test runner service to run tests against a containerized Cloud instance.
#
# This service reverse proxies the given $CYPRESS_BASE_URL to `localhost:3000`.
# This is necessary for certain tests which require a secure context, which
# can typically only be achieved when Cloud is served at `localhost` or
# remotely behind SSL.
#
# For more information, refer to:
# https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts
#
# If the local Cloud Manager instance is served at `localhost:3000` (when
# running Cloud Manager locally during development, for example), prefer the
# `cypress_local` service instead.
cypress_containerized:
<<: *default-runner
build:
context: .
dockerfile: ./packages/manager/Dockerfile
target: e2e-reverse-proxy
environment:
<<: *default-env
MANAGER_OAUTH: ${MANAGER_OAUTH}
CYPRESS_BASE_URL: "http://localhost:3000"
REVERSE_PROXY_URL: ${CYPRESS_BASE_URL}
depends_on:
web:
condition: service_healthy
entrypoint:
- "/bin/sh"
- "-c"
- "caddy reverse-proxy --from $${CYPRESS_BASE_URL} --to $${REVERSE_PROXY_URL} & yarn $0 $@"
# Cypress component test runner service.
#
# Unlike other Cloud Manager Cypress tests, these tests can be run without
# requiring a Cloud Manager environment.
cypress_component:
<<: *default-runner
environment:
CY_TEST_DISABLE_RETRIES: ${CY_TEST_DISABLE_RETRIES}
CY_TEST_JUNIT_REPORT: ${CY_TEST_JUNIT_REPORT}
# --> ! DEPRECATION NOTICE ! <--
# The services below this line are deprecated, and will be deleted soon.
# Don't build any pipelines or write any scripts that depend on these.
# Instead, opt to use `cypress_local` in places where you would've used `e2e`,
# use `cypress_remote` in places where you would've used `e2e_heimdall`, and
# use `cypress_component` in places where you would've used `component`.
# Generic end-to-end test runner for Cloud's primary testing pipeline.
# Configured to run against a local Cloud instance.
e2e:
<<: *default-runner
environment:
<<: *default-env
MANAGER_OAUTH: ${MANAGER_OAUTH}
entrypoint: ['yarn', 'cy:e2e']
# Component test runner.
# Does not require any Cloud Manager environment to run.
component:
<<: *default-runner
depends_on: []
environment:
CY_TEST_DISABLE_RETRIES: ${CY_TEST_DISABLE_RETRIES}
CY_TEST_JUNIT_REPORT: ${CY_TEST_JUNIT_REPORT}
entrypoint: ['yarn', 'cy:component:run']
# End-to-end test runner for Cloud's synthetic monitoring tests.
# Configured to run against a remote Cloud instance hosted at some URL.
e2e_heimdall:
<<: *default-runner
depends_on: []
environment:
<<: *default-env
MANAGER_OAUTH: ${MANAGER_OAUTH}
entrypoint: ['yarn', 'cy:e2e']