-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path.gitlab-ci.yml
260 lines (243 loc) · 6.86 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
image: docker.slock.it/build-images/node:11-alpine
variables:
COMMIT_IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
RELEASE_IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
stages:
- build
- test
- package
- analysis
- deploy
build-server:
stage: build
tags:
- short-jobs
script:
# - sh /prepare.sh
- npm install
- npm run build
artifacts:
paths:
- js/
test-parity:
stage: test
tags:
- short-jobs
variables:
RPCURL: http://parity:8545
IPFS_URL: http://ipfs:5001
services:
- name: jbenet/go-ipfs:latest
command:
- daemon
- --offline
alias: ipfs
- name: slockit/parity-time-maschine:v0.0.1
alias: parity
script:
# - sh /prepare.sh
- npm install
- npm run testReport
artifacts:
name: "test-reports-$CI_JOB_NAME"
paths:
- test/report
reports:
junit: mocha.xml
test-nethermind:
stage: test
allow_failure: true
tags:
- short-jobs
variables:
RPCURL: http://nethermind:8545
IPFS_URL: http://ipfs:5001
services:
- name: jbenet/go-ipfs:latest
command:
- daemon
- --offline
alias: ipfs
- name: docker.slock.it/build-images/nethermind
alias: nethermind
script:
# - sh /prepare.sh
- npm install
- npm run testReport
artifacts:
name: "test-reports-$CI_JOB_NAME"
paths:
- test/report
reports:
junit: mocha.xml
test-geth:
stage: test
coverage: '/Lines.*:\s+(\d+.\d+\%)/'
tags:
- short-jobs
variables:
RPCURL: http://geth:8545
IPFS_URL: http://ipfs:5001
services:
- name: jbenet/go-ipfs:latest
command:
- daemon
- --offline
alias: ipfs
- name: docker.slock.it/core-technology/geth-timemachine:master
alias: geth
script:
# - sh /prepare.sh
- npm install
- npm run testReport
artifacts:
name: "test-reports-$CI_JOB_NAME"
paths:
- test/report
reports:
junit: mocha.xml
package-docker:
stage: package
tags:
- short-jobs
services:
- docker:dind
image: docker.slock.it/build-images/deployment
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build --build-arg NPM_REGISTRY_TOKEN=${NPM_REGISTRY_TOKEN} --build-arg CI_COMMIT_SHA=${CI_COMMIT_SHA} --build-arg VERSION=${COMMIT_IMAGE_TAG} -t $COMMIT_IMAGE_TAG .
- docker tag $COMMIT_IMAGE_TAG $RELEASE_IMAGE_TAG
- docker push $RELEASE_IMAGE_TAG
- docker push $COMMIT_IMAGE_TAG
##### analyse #####
vulnerability-analysis:
stage: analysis
tags:
- short-jobs
allow_failure: true
dependencies:
- package-docker
image: docker.slock.it/build-images/vulnerability-testing-tools
script:
- cat deployment/vulnerability-analysis-message.txt
- export TRIVY_AUTH_URL=$CI_REGISTRY
- export TRIVY_USERNAME=gitlab-ci-token
- export TRIVY_PASSWORD=$CI_JOB_TOKEN
- trivy --timeout 10m --no-progress -f json -o vulnerability_analysis.json $COMMIT_IMAGE_TAG
artifacts:
paths:
- vulnerability_analysis.json
# Deployment Section
pages:
stage: deploy
tags:
- short-jobs
environment:
name: test-results
url: http://in3.git-pages.slock.it/in3-server
only:
refs:
- develop
dependencies:
- test-parity
- test-geth
- vulnerability-analysis
script:
- mkdir -p public/
- cp -r test/report public/coverage
- cp vulnerability_analysis.json public/ || echo '{"error":"was_missing"}' > public/vulnerability_analysis.json
- echo "<html><body><h1>Incubed report for last develop CI pipeline</h1><ul><li><a href='vulnerability_analysis.json'>Vulnerability Analysis</a></li><li><a href='coverage/index.html'>Code coverage</a></li></ul></body></html>" > public/index.html
artifacts:
paths:
- public
dockerhub-deploy:
stage: deploy
when: manual
only:
- /^v[0-9]+.[0-9]+.[0-9]+(\-RC[0-9]+)?$/
except:
- branches
tags:
- short-jobs
services:
- docker:dind
image: docker.slock.it/build-images/deployment
variables:
IMAGE_TAG: slockit/in3-node:$CI_COMMIT_TAG
before_script:
- docker login -u ${DOCKERHUB_USERNAME} -p ${DOCKERHUB_PASSWORD} ${DOCKERHUB_REGISTRY}
script:
- docker build --build-arg NPM_REGISTRY_TOKEN=${NPM_REGISTRY_TOKEN} --build-arg CI_COMMIT_SHA=${CI_COMMIT_SHA} -t $IMAGE_TAG .
- docker push $IMAGE_TAG
- docker tag $IMAGE_TAG slockit/in3-node:latest
- docker push slockit/in3-node:latest
.register-with-sentry:
stage: deploy
tags:
- short-jobs
image: docker.slock.it/build-images/deployment
script:
- sentry-cli releases new -p in3-server in3-server@${CI_COMMIT_REF_NAME}
- sentry-cli releases deploys in3-server@${CI_COMMIT_REF_NAME} new -e ${TARGET}
- sentry-cli releases set-commits --auto in3-server@${CI_COMMIT_REF_NAME}
- sentry-cli releases files in3-server@${CI_COMMIT_REF_NAME} upload-sourcemaps js/src/
register-with-sentry-production:
extends: .register-with-sentry
only:
- /^v[0-9]+.[0-9]+.[0-9]+(\-RC[0-9]+)?$/
except:
- branches
variables:
TARGET: production
# Production deployments
deploy-to-dc:
stage: deploy
when: manual
only:
- /^v[0-9]+.[0-9]+.[0-9]+(\-RC[0-9]+)?$/
except:
- branches
allow_failure: false
environment:
name: internal
tags:
- deployment
image: docker.slock.it/build-images/deployment
script:
- cd deployment
- helm upgrade --atomic -i in3-lb in3-lb
- helm upgrade --atomic -i in3-server-ewc in3-server
--values in3-server/values-ewc.yaml
--values ${PRIVATE_KEYS}
--set stage=${CI_ENVIRONMENT_SLUG}
--set version=${CI_COMMIT_TAG}
--set ciProject=${CI_PROJECT_PATH_SLUG}
--set ciEnvironment=${CI_ENVIRONMENT_SLUG}
- helm upgrade --atomic -i in3-server-mainnet in3-server
--values in3-server/values-mainnet.yaml
--values ${PRIVATE_KEYS}
--set stage=${CI_ENVIRONMENT_SLUG}
--set version=${CI_COMMIT_TAG}
--set ciProject=${CI_PROJECT_PATH_SLUG}
--set ciEnvironment=${CI_ENVIRONMENT_SLUG}
- helm upgrade --atomic -i in3-server-goerli in3-server
--values in3-server/values-goerli.yaml
--values ${PRIVATE_KEYS}
--set stage=${CI_ENVIRONMENT_SLUG}
--set version=${CI_COMMIT_TAG}
--set ciProject=${CI_PROJECT_PATH_SLUG}
--set ciEnvironment=${CI_ENVIRONMENT_SLUG}
- helm upgrade --atomic -i in3-server-btc in3-server
--values in3-server/values-btc.yaml
--values ${PRIVATE_KEYS}
--set stage=${CI_ENVIRONMENT_SLUG}
--set version=${CI_COMMIT_TAG}
--set ciProject=${CI_PROJECT_PATH_SLUG}
--set ciEnvironment=${CI_ENVIRONMENT_SLUG}
- helm upgrade --atomic -i in3-server-ipfs in3-server
--values in3-server/values-ipfs.yaml
--values ${PRIVATE_KEYS}
--set stage=${CI_ENVIRONMENT_SLUG}
--set version=${CI_COMMIT_TAG}
--set ciProject=${CI_PROJECT_PATH_SLUG}
--set ciEnvironment=${CI_ENVIRONMENT_SLUG}