-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
565 lines (486 loc) · 12.8 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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
stages:
- build
- deploy
- robot
- docs
- test
- test_before_2020_04_19
- repos
- cleanup
variables:
COUCHDB_USER: op
COUCHDB_PASSWORD: op
GIT_STRATEGY: none
.werf:
before_script:
- type multiwerf && source <(multiwerf use 1.0 beta)
- type werf && source <(werf ci-env gitlab --tagging-strategy tag-or-branch --verbose)
.build:
extends: .werf
stage: build
script:
- werf build-and-publish
except:
- schedules
tags:
- shell
variables:
GIT_STRATEGY: fetch
WERF_STAGES_STORAGE: ":local"
build:
extends: .build
only:
- branches
variables:
WERF_TAG_GIT_COMMIT: ci-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
build_master:
extends: .build
only:
- master
variables:
WERF_TAG_GIT_BRANCH: $CI_COMMIT_REF_SLUG
build_tag:
extends: .build
only:
- tags
variables:
WERF_TAG_GIT_TAG: $CI_COMMIT_TAG
add_to_repo:
stage: repos
tags:
- repo-staging
script:
- echo "Who run user = ${GITLAB_USER_NAME} ; email = ${GITLAB_USER_EMAIL} ; login = ${GITLAB_USER_LOGIN} ;"
- 'curl --header "PRIVATE-TOKEN: $API_TOKEN_REPO_STAGING" https://git.prozorro.gov.ua/api/v4/projects/$CI_PROJECT_ID/repository/archive?sha=$CI_COMMIT_SHORT_SHA -o ~/pkg/$CI_PROJECT_NAME-$CI_COMMIT_TAG.tar.gz'
- 'curl --header "PRIVATE-TOKEN: $API_TOKEN_REPO_STAGING" https://git.prozorro.gov.ua/api/v4/projects/$CI_PROJECT_ID/repository/archive.zip?sha=$CI_COMMIT_SHORT_SHA -o ~/pkg/$CI_PROJECT_NAME-$CI_COMMIT_TAG.zip'
only:
- /^v?([0-9]{1}).([0-9]{1})/
variables:
GIT_STRATEGY: none
cleanup:
extends: .werf
stage: cleanup
script:
- docker login -u $WERF_IMAGES_CLEANUP_USERNAME -p $WERF_IMAGES_CLEANUP_PASSWORD $WERF_IMAGES_REPO
- werf cleanup
only:
- schedules
tags:
- shell
variables:
WERF_STAGES_STORAGE: ":local"
.base_deploy: &base_deploy
stage: deploy
script:
- helm repo add prozorro $REPO_URL
- helm repo update
- helm upgrade $CI_COMMIT_REF_SLUG --install prozorro/$HELM_CHART --namespace $HELM_NAMESPACE --set $HELM_TAG_PARAMETER=$TAG --wait --debug
dependencies:
- build
tags:
- shell
variables:
TAG: ci-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
review:
<<: *base_deploy
environment:
name: review/${CI_COMMIT_REF_SLUG}
action: start
url: http://api.${CI_COMMIT_REF_SLUG}.${K8S_DOMAIN}/api/2.5/tenders
on_stop: stop_review
dependencies:
- build
only:
- branches
except:
- master
- schedules
when: manual
deploy_master:
<<: *base_deploy
environment:
name: review/${CI_COMMIT_REF_SLUG}
url: http://api.${CI_COMMIT_REF_SLUG}.${K8S_DOMAIN}/api/2.5/tenders
dependencies:
- build
only:
- master
except:
- schedules
robot_tests:
stage: robot
script:
- curl "$JENKINS_URL/buildWithParameters?token=$JENKINS_TOKEN&cause=$CI_COMMIT_REF_SLUG&RELEASE_NAME=$CI_COMMIT_REF_SLUG&API_VERSION=2.5"
- echo $JENKINS_URL
tags:
- shell
only:
- branches
dependencies:
- review
except:
- schedules
when: manual
stop_review:
stage: deploy
script:
- helm delete $CI_COMMIT_REF_SLUG --purge
environment:
name: review/${CI_COMMIT_REF_SLUG}
action: stop
tags:
- shell
only:
- branches
except:
- master
- schedules
when: manual
.setuptools:
image: python:2.7
services:
- couchdb:1.6
tags:
- kube
variables:
GIT_STRATEGY: clone
only:
- branches
except:
- schedules
before_script:
- apt-get update
- apt-get install -y libsodium-dev
- pip install --upgrade pip setuptools
- echo '127.0.0.1 couchdb' >> /etc/hosts
test:
extends: .setuptools
stage: build
script:
- python setup.py test
when: manual
docs:
extends: .setuptools
stage: docs
script:
- python setup.py test --addopts="docs/tests --color=yes"
- (set -e; [[ $(git diff) ]] && { git diff; exit 1; } || exit 0)
when: manual
allow_failure: false
needs:
- build
variables:
KUBERNETES_CPU_REQUEST: 3000m
KUBERNETES_MEMORY_REQUEST: 4Gi
.test_base:
image: $CI_REGISTRY_IMAGE:ci-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
stage: test
services:
- couchdb:1.6
tags:
- kube
only:
- branches
except:
- schedules
needs:
- build
before_script:
- echo '127.0.0.1 couchdb' >> /etc/hosts
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
when: manual
allow_failure: false
retry:
max: 2
when: runner_system_failure
variables:
KUBERNETES_CPU_REQUEST: 3000m
KUBERNETES_MEMORY_REQUEST: 768Mi
.test:
extends: .test_base
stage: test
script:
- cd /app
- py.test $TESTS_PATH --cov=$COV_PATH --cov-config=$COV_FILE -v --color=yes --dist=each
--tx=popen//id=sand//env:DB_NAME=test_sandbox//env:SANDBOX_MODE=1//env:SINGLE_APP=1
--tx=popen//id=prod//env:DB_NAME=test_prod//env:SANDBOX_MODE=//env:SINGLE_APP=1
.test_before_2020_04_19:
extends: .test_base
stage: test_before_2020_04_19
script:
- cd /app
- py.test $TESTS_PATH --cov=$COV_PATH --cov-config=$COV_FILE -v --color=yes --dist=each
--tx=popen//id=sand//env:DB_NAME=test_sandbox//env:SANDBOX_MODE=1//env:SINGLE_APP=1//env:DEFAULT_RELEASE_2020_04_19=2030-01-01
--tx=popen//id=prod//env:DB_NAME=test_prod//env:SANDBOX_MODE=//env:SINGLE_APP=1//env:DEFAULT_RELEASE_2020_04_19=2030-01-01
.test_relocation_api:
variables:
TESTS_PATH: src/openprocurement/relocation/api/tests
COV_PATH: src/openprocurement/relocation/api
COV_FILE: .coveragerc
KUBERNETES_CPU_REQUEST: 700m
KUBERNETES_MEMORY_REQUEST: 1100Mi
test_relocation_api:
extends:
- .test
- .test_relocation_api
test_relocation_api_before_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_relocation_api
.test_tender_esco:
variables:
TESTS_PATH: src/openprocurement/tender/esco/tests
COV_PATH: src/openprocurement/tender/esco
COV_FILE: .coveragerc
KUBERNETES_MEMORY_REQUEST: 1500Mi
test_tender_esco:
extends:
- .test
- .test_tender_esco
test_tender_esco_before_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_tender_esco
.test_tender_openeu:
variables:
TESTS_PATH: src/openprocurement/tender/openeu/tests
COV_PATH: src/openprocurement/tender/openeu
COV_FILE: .coveragerc
KUBERNETES_CPU_REQUEST: 1500m
test_tender_openeu:
extends:
- .test
- .test_tender_openeu
test_tender_openeu_before_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_tender_openeu
.test_tender_cfaua:
variables:
TESTS_PATH: src/openprocurement/tender/cfaua/tests
COV_PATH: src/openprocurement/tender/cfaua
COV_FILE: .coveragerc
KUBERNETES_CPU_REQUEST: 1500m
test_tender_cfaua:
extends:
- .test
- .test_tender_cfaua
test_tender_cfaua_before_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_tender_cfaua
.test_tender_comp_stage2:
variables:
TESTS_PATH: src/openprocurement/tender/competitivedialogue/tests/stage2
COV_PATH: src/openprocurement/tender/competitivedialogue/
COV_FILE: src/openprocurement/tender/competitivedialogue/tests/stage2/.coveragerc
KUBERNETES_MEMORY_REQUEST: 1600Mi
test_tender_comp_stage2:
extends:
- .test
- .test_tender_comp_stage2
test_tender_comp_stage2_before_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_tender_comp_stage2
.test_tender_core:
variables:
TESTS_PATH: src/openprocurement/tender/core/tests
COV_PATH: src/openprocurement/tender/core
COV_FILE: .coveragerc
test_tender_core:
extends:
- .test
- .test_tender_core
test_tender_core_before_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_tender_core
.test_api:
variables:
TESTS_PATH: src/openprocurement/api/tests
COV_PATH: src/openprocurement/api
COV_FILE: .coveragerc
KUBERNETES_MEMORY_REQUEST: 1100Mi
KUBERNETES_CPU_REQUEST: 500m
test_api:
extends:
- .test
- .test_api
test_api_before_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_api
.test_agreement_core:
variables:
TESTS_PATH: src/openprocurement/agreement/core/tests
COV_PATH: src/openprocurement/agreement/core
COV_FILE: .coveragerc
test_agreement_core:
extends:
- .test
- .test_agreement_core
test_agreement_core_before_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_agreement_core
.test_agreement_cfaua:
variables:
TESTS_PATH: src/openprocurement/agreement/cfaua/tests
COV_PATH: src/openprocurement/agreement/cfaua
COV_FILE: .coveragerc
KUBERNETES_CPU_REQUEST: 1500m
test_agreement_cfaua:
extends:
- .test
- .test_agreement_cfaua
test_agreement_cfaua_before_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_agreement_cfaua
.test_contracting_api:
variables:
TESTS_PATH: src/openprocurement/contracting/api/tests
COV_PATH: src/openprocurement/contracting/api
COV_FILE: .coveragerc
KUBERNETES_MEMORY_REQUEST: 1200Mi
KUBERNETES_CPU_REQUEST: 500m
test_contracting_api:
extends:
- .test
- .test_contracting_api
test_contracting_api_before_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_contracting_api
.test_planning_api:
variables:
TESTS_PATH: src/openprocurement/planning/api/tests
COV_PATH: src/openprocurement/planning/api
COV_FILE: .coveragerc
KUBERNETES_MEMORY_REQUEST: 1000Mi
KUBERNETES_CPU_REQUEST: 1000m
test_planning_api:
extends:
- .test
- .test_planning_api
test_planning_api_before_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_planning_api
.test_historical_core:
variables:
TESTS_PATH: src/openprocurement/historical/core/tests
COV_PATH: src/openprocurement/historical/core
COV_FILE: .coveragerc
KUBERNETES_MEMORY_REQUEST: 500Mi
KUBERNETES_CPU_REQUEST: 500m
test_historical_core:
extends:
- .test
- .test_historical_core
test_historical_core_before_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_historical_core
.test_historical_tender:
variables:
TESTS_PATH: src/openprocurement/historical/tender/tests
COV_PATH: src/openprocurement/historical/tender
COV_FILE: .coveragerc
KUBERNETES_MEMORY_REQUEST: 500Mi
KUBERNETES_CPU_REQUEST: 500m
test_historical_tender:
extends:
- .test
- .test_historical_tender
test_historical_tender_before_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_historical_tender
.test_tender_comp_stage1:
variables:
TESTS_PATH: src/openprocurement/tender/competitivedialogue/tests/stage1
COV_PATH: src/openprocurement/tender/competitivedialogue/
COV_FILE: src/openprocurement/tender/competitivedialogue/tests/stage1/.coveragerc
KUBERNETES_MEMORY_REQUEST: 1600Mi
KUBERNETES_CPU_REQUEST: 3000m
test_tender_comp_stage1:
extends:
- .test
- .test_tender_comp_stage1
test_tender_comp_stage1_before_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_tender_comp_stage1
.test_tender_limited:
variables:
TESTS_PATH: src/openprocurement/tender/limited/tests
COV_PATH: src/openprocurement/tender/limited
COV_FILE: .coveragerc
KUBERNETES_CPU_REQUEST: 600m
test_tender_limited:
extends:
- .test
- .test_tender_limited
test_tender_limited_before_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_tender_limited
.test_tender_openua:
variables:
TESTS_PATH: src/openprocurement/tender/openua/tests
COV_PATH: src/openprocurement/tender/openua
COV_FILE: .coveragerc
KUBERNETES_MEMORY_REQUEST: 1400Mi
test_tender_openua:
extends:
- .test
- .test_tender_openua
test_tender_openua_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_tender_openua
.test_tender_belowthreshold:
variables:
TESTS_PATH: src/openprocurement/tender/belowthreshold/tests
COV_PATH: src/openprocurement/tender/belowthreshold
COV_FILE: .coveragerc
KUBERNETES_CPU_REQUEST: 600m
test_tender_belowthreshold:
extends:
- .test
- .test_tender_belowthreshold
test_tender_belowthreshold_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_tender_belowthreshold
.test_tender_openuadefense:
variables:
TESTS_PATH: src/openprocurement/tender/openuadefense/tests
COV_PATH: src/openprocurement/tender/openuadefense
COV_FILE: .coveragerc
KUBERNETES_CPU_REQUEST: 1800m
test_tender_openuadefense:
extends:
- .test
- .test_tender_openuadefense
test_tender_openuadefense_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_tender_openuadefense
.test_tender_cfaselectionua:
variables:
TESTS_PATH: src/openprocurement/tender/cfaselectionua/tests
COV_PATH: src/openprocurement/tender/cfaselectionua
COV_FILE: .coveragerc
KUBERNETES_MEMORY_REQUEST: 1200Mi
KUBERNETES_CPU_REQUEST: 2500m
test_tender_cfaselectionua:
extends:
- .test
- .test_tender_cfaselectionua
test_tender_cfaselectionua_2020_04_19:
extends:
- .test_before_2020_04_19
- .test_tender_cfaselectionua