-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
207 lines (191 loc) · 6.73 KB
/
.gitlab-ci.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
include:
- project: cs/gitlabci-templates
file: /build-image-using-kaniko.yml
variables:
FF_USE_FASTZIP: 'true'
ARTIFACT_COMPRESSION_LEVEL: 'fastest'
CACHE_COMPRESSION_LEVEL: 'fastest'
KUBERNETES_MEMORY_REQUEST: 2Gi
KUBERNETES_MEMORY_LIMIT: 4Gi
KUBERNETES_CPU_REQUEST: 2
KUBERNETES_CPU_LIMIT: 4
default:
interruptible: true
image: node:21-alpine
.install_packages:
script: &install_packages
- npm ci --cache .npm --prefer-offline
.package_cache:
cache: &package_cache
key:
files:
- package-lock.json
paths:
- .npm
policy: pull-push
.build_cache:
cache: &build_cache
key: $CI_COMMIT_REF_SLUG
paths:
- .next/cache
policy: pull-push
.heavy_job:
variables:
KUBERNETES_MEMORY_REQUEST: 4Gi
KUBERNETES_MEMORY_LIMIT: 8Gi
KUBERNETES_CPU_REQUEST: 3
NODE_OPTIONS: --max-old-space-size=4096
stages:
- setup
- check
- build
- deploy
setup:
stage: setup
cache:
<<: *package_cache
policy: push
rules:
- if: $CI_PIPELINE_SOURCE == "push"
changes:
- package-lock.json
script: *install_packages
eslint:
stage: check
cache:
<<: *package_cache
policy: pull
script:
- *install_packages
- npm run lint
prettier:
stage: check
cache:
<<: *package_cache
policy: pull
script:
- *install_packages
- npm run prettier:check
unit-test:
stage: check
extends: .heavy_job
cache:
<<: *package_cache
policy: pull
script:
- *install_packages
- npm run test:ci
build:
stage: check
extends: .heavy_job
cache:
- <<: *package_cache
policy: pull
- <<: *build_cache
script:
- *install_packages
- npm run build
except:
- develop
- main
deploy-aws-production:
stage: deploy
extends:
- .heavy_job
- .build-image-using-kaniko
variables:
CI_PROJECT_DIR: /builds/project/sbo/core-web-app
CI_REGISTRY_IMAGE: bluebrain/sbo-core-web-app
CI_REGISTRY: https://index.docker.io/v1/
CI_REGISTRY_USER: bbpbuildbot
CI_REGISTRY_PASSWORD: $CI_REGISTRY_PASSWORD_DOCKERHUB
REGISTRY_IMAGE_TAG: latest
NEXT_PUBLIC_ENVIRONMENT: Production
NEXT_PUBLIC_BASE_PATH: /app
NEXT_PUBLIC_NEXUS_URL: https://openbluebrain.com/api/nexus/v1
NEXT_PUBLIC_SENTRY_DSN: $SENTRY_DSN
NEXT_PUBLIC_BRAIN_REGION_ONTOLOGY_RESOURCE_TAG: v2.0.0
NEXT_PUBLIC_CELL_COMPOSITION_TAG: v1.1.0
NEXT_PUBLIC_ATLAS_ES_VIEW_ID: https://bbp.epfl.ch/data/bbp/atlas/es_aggregate_view_tags_v1.1.0_v2.2.4
NEXT_PUBLIC_KG_INFERENCE_BASE_URL: https://openbluebrain.com/api/kg-inference
NEXT_PUBLIC_THUMBNAIL_GENERATION_BASE_URL: https://openbluebrain.com/api/thumbnail-generation
NEXT_PUBLIC_VIRTUAL_LAB_API_URL: https://openbluebrain.com/api/virtual-lab-manager
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: pk_test_51P6uAFFE4Bi50cLlatJIc0fUPsP0jQkaCCJ8TTkIYOOLIrLzxX1M9p1kVD11drNqsF9p7yiaumWJ8UHb3ptJJRXB00y3qjYReV
NEXT_PUBLIC_BBS_ML_PRIVATE_BASE_URL: http://internal-sbo-poc-private-alb-1398645643.us-east-1.elb.amazonaws.com:3000/api/literature
NEXT_PUBLIC_CELL_SVC_BASE_URL: https://openbluebrain.com/api/circuit
NEXT_PUBLIC_BLUE_NAAS_URL: https://openbluebrain.com/api/bluenaas
SENTRY_AUTH_TOKEN: $SENTRY_AUTH_TOKEN
MAILCHIMP_API_KEY: $MAILCHIMP_API_KEY
MAILCHIMP_AUDIENCE_ID: $MAILCHIMP_AUDIENCE_ID
KANIKO_EXTRA_ARGS: >
--build-arg=NEXT_PUBLIC_BASE_PATH
--build-arg=NEXT_PUBLIC_ENVIRONMENT
--build-arg=NEXT_PUBLIC_SENTRY_DSN
--build-arg=SENTRY_AUTH_TOKEN
--build-arg=NEXT_PUBLIC_NEXUS_URL
--build-arg=NEXT_PUBLIC_ATLAS_ES_VIEW_ID
--build-arg=NEXT_PUBLIC_KG_INFERENCE_BASE_URL
--build-arg=NEXT_PUBLIC_THUMBNAIL_GENERATION_BASE_URL
--build-arg=NEXT_PUBLIC_VIRTUAL_LAB_API_URL
--build-arg=NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
--build-arg=NEXT_PUBLIC_BRAIN_REGION_ONTOLOGY_RESOURCE_TAG
--build-arg=NEXT_PUBLIC_CELL_COMPOSITION_TAG
--build-arg=NEXT_PUBLIC_BBS_ML_PRIVATE_BASE_URL
--build-arg=NEXT_PUBLIC_CELL_SVC_BASE_URL
--build-arg=NEXT_PUBLIC_BLUE_NAAS_URL
--build-arg=NODE_OPTIONS
--build-arg=MAILCHIMP_API_KEY
--build-arg=MAILCHIMP_AUDIENCE_ID
only:
- develop
deploy-aws-staging:
stage: deploy
extends:
- .heavy_job
- .build-image-using-kaniko
variables:
CI_PROJECT_DIR: /builds/project/sbo/core-web-app
CI_REGISTRY_IMAGE: bluebrain/sbo-core-web-app
CI_REGISTRY: https://index.docker.io/v1/
CI_REGISTRY_USER: bbpbuildbot
CI_REGISTRY_PASSWORD: $CI_REGISTRY_PASSWORD_DOCKERHUB
REGISTRY_IMAGE_TAG: staging
NEXT_PUBLIC_ENVIRONMENT: Staging
NEXT_PUBLIC_BASE_PATH: /app
NEXT_PUBLIC_NEXUS_URL: https://staging.openbluebrain.com/api/nexus/v1
NEXT_PUBLIC_SENTRY_DSN: $SENTRY_DSN
NEXT_PUBLIC_BRAIN_REGION_ONTOLOGY_RESOURCE_TAG: v2.0.0
NEXT_PUBLIC_CELL_COMPOSITION_TAG: v1.1.0
NEXT_PUBLIC_ATLAS_ES_VIEW_ID: https://bbp.epfl.ch/data/bbp/atlas/es_aggregate_view_tags_v1.1.0_v2.2.4
NEXT_PUBLIC_KG_INFERENCE_BASE_URL: https://staging.openbluebrain.com/api/kg-inference
NEXT_PUBLIC_THUMBNAIL_GENERATION_BASE_URL: https://staging.openbluebrain.com/api/thumbnail-generation
NEXT_PUBLIC_VIRTUAL_LAB_API_URL: https://staging.openbluebrain.com/api/virtual-lab-manager
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: pk_test_51P6uAFFE4Bi50cLlatJIc0fUPsP0jQkaCCJ8TTkIYOOLIrLzxX1M9p1kVD11drNqsF9p7yiaumWJ8UHb3ptJJRXB00y3qjYReV
# TODO: As this env var is only used server-side, remove NEXT_PUBLIC prefix, update env var validation and deployment configuration.
NEXT_PUBLIC_BBS_ML_PRIVATE_BASE_URL: http://internal-sbo-poc-private-alb-1398645643.us-east-1.elb.amazonaws.com:3000/api/literature
NEXT_PUBLIC_CELL_SVC_BASE_URL: https://staging.openbluebrain.com/api/circuit
NEXT_PUBLIC_BLUE_NAAS_URL: https://staging.openbluebrain.com/api/bluenaas
SENTRY_AUTH_TOKEN: $SENTRY_AUTH_TOKEN
MAILCHIMP_API_KEY: $MAILCHIMP_API_KEY
MAILCHIMP_AUDIENCE_ID: $MAILCHIMP_AUDIENCE_ID
KANIKO_EXTRA_ARGS: >
--build-arg=NEXT_PUBLIC_BASE_PATH
--build-arg=NEXT_PUBLIC_ENVIRONMENT
--build-arg=NEXT_PUBLIC_SENTRY_DSN
--build-arg=SENTRY_AUTH_TOKEN
--build-arg=NEXT_PUBLIC_NEXUS_URL
--build-arg=NEXT_PUBLIC_ATLAS_ES_VIEW_ID
--build-arg=NEXT_PUBLIC_KG_INFERENCE_BASE_URL
--build-arg=NEXT_PUBLIC_THUMBNAIL_GENERATION_BASE_URL
--build-arg=NEXT_PUBLIC_VIRTUAL_LAB_API_URL
--build-arg=NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
--build-arg=NEXT_PUBLIC_BRAIN_REGION_ONTOLOGY_RESOURCE_TAG
--build-arg=NEXT_PUBLIC_CELL_COMPOSITION_TAG
--build-arg=NEXT_PUBLIC_BBS_ML_PRIVATE_BASE_URL
--build-arg=NEXT_PUBLIC_CELL_SVC_BASE_URL
--build-arg=NEXT_PUBLIC_BLUE_NAAS_URL
--build-arg=NODE_OPTIONS
--build-arg=MAILCHIMP_API_KEY
--build-arg=MAILCHIMP_AUDIENCE_ID
only:
- develop