forked from samvera/hyku
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
287 lines (274 loc) · 6.63 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
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
---
stages:
- build
- test
- review
- staging
before_script:
- export TAG=${CI_COMMIT_SHORT_SHA}
- export BRANCH=${CI_COMMIT_REF_NAME}
- export REGISTRY_HOST=${CI_REGISTRY}
- export REGISTRY_URI="/${CI_PROJECT_PATH}"
hyku.build:
stage: build
script:
- docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
- docker-compose build web
- docker-compose build worker
- docker-compose push web
- docker-compose push worker
only:
refs:
- merge_requests
- main
tags:
- local
lint:
stage: test
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
allow_failure: true
script:
- cd /app/samvera/hyrax-webapp
- bundle check || bundle
- bundle exec rubocop
only:
refs:
- merge_requests
tags:
- kubernetes
test:
stage: test
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
allow_failure: true
variables:
ALLOW_ANONYMOUS_LOGIN: "yes"
CONFDIR: "/app/samvera/hyrax-webapp/solr/conf"
CHROME_HOSTNAME: chrome
DB_ADAPTER: postgresql
DB_CLEANER_ALLOW_REMOTE_DB_URL: "true"
DB_HOST: db
DB_NAME: hyku
DB_URL: postgres://postgres:postgres@db/hyku
DB_USER: postgres
DB_PORT: 5432
FCREPO_BASE_PATH: /hykudemo
FCREPO_HOST: fcrepo
FCREPO_PORT: 8081
FCREPO_REST_PATH: rest
FF_NETWORK_PER_BUILD: 1
GIT_STRATEGY: none
JAVA_OPTIONS: -Djetty.port=8081
IN_DOCKER: "true"
POSTGRESQL_DATABASE: hyku
POSTGRESQL_PASSWORD: postgres
REDIS_HOST: redis
SOLR_ADMIN_PASSWORD: admin
SOLR_ADMIN_USER: admin
SOLR_ADMIN_USER: admin
SOLR_CLOUD_BOOTSTRAP: "yes"
SOLR_COLLECTION_NAME: hyku-test
SOLR_CONFIGSET_NAME: hyku
SOLR_ENABLE_AUTHENTICATION: "yes"
SOLR_ENABLE_CLOUD_MODE: "yes"
SOLR_HOST: solr
SOLR_PORT: 8983
SOLR_URL: http://admin:admin@solr:8983/solr/
SOLR_ZK_HOSTS: zk:2181
ZOO_HEAP_SIZE: 128
ZOO_PORT_NUMBER: 2181
services:
- name: bitnami/postgresql:12.6.0
alias: db
- name: samvera/fcrepo4:4.7.5
alias: fcrepo
- name: redis:5-alpine
alias: redis
- name: bitnami/zookeeper:3
alias: zk
- name: bitnami/solr:8
alias: solr
- name: selenium/standalone-chrome:3.141
alias: chrome
before_script:
- >-
solrcloud-upload-configset.sh /app/samvera/hyrax-webapp/solr/conf &&
SOLR_COLLECTION_NAME=hydra-test solrcloud-assign-configset.sh &&
solrcloud-assign-configset.sh
script:
- rm -f /home/app/webapp/tmp/capybara/*
- rm -rf $CI_PROJECT_DIR/capybara
- cd /app/samvera/hyrax-webapp
# - sleep 30m
- rspec --format progress --tag ~speed:slow --format RspecJunitFormatter --out rspec.xml
after_script:
- test -e /home/app/webapp/tmp/capybara && cp -r /home/app/webapp/tmp/capybara $CI_PROJECT_DIR/capybara
- test -e /home/app/webapp/rspec.xml && cp /home/app/webapp/rspec.xml $CI_PROJECT_DIR/rspec.xml
only:
refs:
- merge_requests
- main
artifacts:
when: always
paths:
- capybara/*.html
- rspec.xml
reports:
junit: rspec.xml
tags:
- kubernetes
hyku.review:
stage: review
needs: ["hyku.build"]
extends:
- .deploy
environment:
name: hyku.review/$CI_MERGE_REQUEST_ID
url: http://hyku-$CI_MERGE_REQUEST_ID.$KUBE_INGRESS_BASE_DOMAIN
on_stop: hyku.review.stop
auto_stop_in: 1 day
only:
refs:
- merge_requests
variables:
DEPLOY_IMAGE: $CI_REGISTRY_IMAGE
DEPLOY_TAG: $CI_COMMIT_SHORT_SHA
WORKER_IMAGE: $CI_REGISTRY_IMAGE/worker
HELM_EXPERIMENTAL_OCI: 1
HELM_EXTRA_ARGS: >
--values ops/review-deploy.yaml
script:
- envsubst < ops/review-deploy.tmpl.yaml > ops/review-deploy.yaml
- ./bin/helm_deploy hyku-$CI_MERGE_REQUEST_ID review
tags:
- kubernetes
hyku.review.stop:
stage: review
extends:
- .deploy
environment:
name: hyku.review/$CI_MERGE_REQUEST_ID
url: http://hyku-$CI_MERGE_REQUEST_ID.$KUBE_INGRESS_BASE_DOMAIN
action: stop
when: manual
allow_failure: true
script:
- .//bin/helm_delete hyku-$CI_MERGE_REQUEST_ID review
only:
refs:
- merge_requests
tags:
- kubernetes
hyku.dev:
stage: staging
extends:
- .deploy
environment:
name: hyku.dev
url: http://hyku-dev.example.com
on_stop: hyku.dev.stop
only:
refs:
- main
variables:
DEPLOY_IMAGE: $CI_REGISTRY_IMAGE
DEPLOY_TAG: $CI_COMMIT_SHORT_SHA
WORKER_IMAGE: $CI_REGISTRY_IMAGE/worker
HELM_EXPERIMENTAL_OCI: 1
HELM_EXTRA_ARGS: >
--values ops/dev-deploy.yaml
script:
- envsubst < ops/dev-deploy.tmpl.yaml > ops/dev-deploy.yaml
- ./bin/helm_deploy hyku-dev dev
tags:
- kubernetes
hyku.dev.stop:
stage: staging
extends:
- .deploy
environment:
name: hyku.dev
url: http://hyku-dev.example.com
action: stop
when: manual
allow_failure: true
script:
- .//bin/helm_delete hyku-dev dev
tags:
- kubernetes
hyku.staging:
stage: staging
extends:
- .deploy
environment:
name: hyku.staging
url: http://dl-hyku-staging.example.com
on_stop: hyku.staging.stop
only:
refs:
- main
variables:
DEPLOY_IMAGE: $CI_REGISTRY_IMAGE
DEPLOY_TAG: $CI_COMMIT_SHORT_SHA
WORKER_IMAGE: $CI_REGISTRY_IMAGE/worker
HELM_EXPERIMENTAL_OCI: 1
HELM_EXTRA_ARGS: >
--values ops/staging-deploy.yaml
script:
- envsubst < ops/staging-deploy.tmpl.yaml > ops/staging-deploy.yaml
- ./bin/helm_deploy hyku-staging staging
tags:
- kubernetes
hyku.staging.stop:
stage: staging
extends:
- .deploy
environment:
name: hyku.staging
url: http://hyku-staging.$KUBE_INGRESS_BASE_DOMAIN
action: stop
when: manual
allow_failure: true
script:
- .//bin/helm_delete hyku-staging staging
tags:
- kubernetes
hyku.production:
stage: staging
extends:
- .deploy
environment:
name: hyku.production
url: http://hyku-production.example.com
on_stop: hyku.production.stop
only:
refs:
- main
when: manual
variables:
DEPLOY_IMAGE: $CI_REGISTRY_IMAGE
DEPLOY_TAG: $CI_COMMIT_SHORT_SHA
WORKER_IMAGE: $CI_REGISTRY_IMAGE/worker
HELM_EXPERIMENTAL_OCI: 1
HELM_EXTRA_ARGS: >
--values ops/production-deploy.yaml
script:
- envsubst < ops/production-deploy.tmpl.yaml > ops/production-deploy.yaml
- ./bin/helm_deploy hyku-production production
tags:
- kubernetes
hyku.production.stop:
stage: staging
extends:
- .deploy
environment:
name: hyku.production
url: http://hyku-production.example.com
action: stop
when: manual
allow_failure: true
script:
- .//bin/helm_delete hyku-production production
tags:
- kubernetes
.deploy:
image: dtzar/helm-kubectl:3.5.3