-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
101 lines (95 loc) · 2.48 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
stages:
- test
- build
- deploy
- robot
variables:
CI_TAG: ci-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
test:
stage: test
image: python:3.9
before_script:
- pip install -r requirements.txt
- pip install -e .
script:
- coverage run -m pytest tests/
- coverage report
coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
build:
image: docker:git
stage: build
tags:
- shell
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE:$CI_TAG .
- docker tag $CI_REGISTRY_IMAGE:$CI_TAG $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
only:
- branches
- tags
dependencies:
- test
review:
stage: deploy
dependencies:
- build
tags:
- shell
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
auto_stop_in: 1 day
variables:
API_TAG: "2.6.60"
TAG: $CI_COMMIT_REF_SLUG
API_HOST: http://api.${CI_COMMIT_REF_SLUG}.${K8S_DOMAIN}
script:
- helm3 repo add prozorro $REPO_URL
- helm3 repo update
- helm3 --debug upgrade ${CI_COMMIT_REF_SLUG} --install prozorro/prozorro --namespace dev-prozorro
--set prozorro.api.image.tag=$API_TAG
--set deployAuctions=false
--set deployAuction=true
--set prozorro-bridges.bridges.agreements.deploy=false
--set prozorro-bridges.bridges.cfaselection.deploy=false
--wait
- helm3 --debug upgrade ${CI_COMMIT_REF_SLUG}-frameworkagreement --install prozorro/prozorro-bridge-frameworkagreement --namespace dev-prozorro
--set bridge_frameworkagreement.container.environment.PUBLIC_API_HOST=$API_HOST
--wait
only:
- branches
except:
- master
when: manual
stop_review:
stage: deploy
script:
- helm3 delete $CI_COMMIT_REF_SLUG --namespace dev-prozorro
- helm3 delete $CI_COMMIT_REF_SLUG-frameworkagreement --namespace dev-prozorro
environment:
name: review/${CI_COMMIT_REF_SLUG}
action: stop
tags:
- shell
only:
- branches
except:
- master
when: manual
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:
- master
when: manual