forked from cau-se/theodolite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
378 lines (337 loc) · 10.2 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
stages:
- build
- test
- check
- deploy
.dind:
tags:
- exec-dind
# see https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
# for image usage and settings for building with TLS and docker in docker
image: docker:19.03.1
services:
- docker:19.03.1-dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
# Theodolite Helm Chart
lint-helm:
stage: check
image:
name: alpine/helm:3.5.2
entrypoint: [""]
tags:
- exec-docker
script: helm lint execution/helm/
# Theodolite Benchmarks
.benchmarks:
image: openjdk:11-jdk
tags:
- exec-docker
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
cache:
paths:
- .gradle/wrapper
- .gradle/caches
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
- cd theodolite-benchmarks
build-benchmarks:
stage: build
extends: .benchmarks
script: ./gradlew --build-cache assemble
artifacts:
paths:
- "theodolite-benchmarks/build/libs/*.jar"
- "theodolite-benchmarks/*/build/libs/*.jar"
- "theodolite-benchmarks/*/build/distributions/*.tar"
expire_in: 6 hours
test-benchmarks:
stage: test
extends: .benchmarks
needs:
- build-benchmarks
script: ./gradlew test --continue
artifacts:
reports:
junit:
- "theodolite-benchmarks/**/build/test-results/test/TEST-*.xml"
checkstyle-benchmarks:
stage: check
extends: .benchmarks
needs:
- build-benchmarks
- test-benchmarks
script: ./gradlew checkstyle --continue
artifacts:
paths:
- "theodolite-benchmarks/*/build/reports/checkstyle/main.html"
when: on_failure
expire_in: 1 day
pmd-benchmarks:
stage: check
extends: .benchmarks
needs:
- build-benchmarks
- test-benchmarks
script: ./gradlew pmd --continue
artifacts:
paths:
- "theodolite-benchmarks/*/build/reports/pmd/*.html"
when: on_failure
expire_in: 1 day
spotbugs-benchmarks:
stage: check
extends: .benchmarks
needs:
- build-benchmarks
- test-benchmarks
script: ./gradlew spotbugs --continue
artifacts:
paths:
- "theodolite-benchmarks/*/build/reports/spotbugs/*.html"
when: on_failure
expire_in: 1 day
.deploy-benchmarks:
stage: deploy
extends:
- .benchmarks
- .dind
needs:
- build-benchmarks
- checkstyle-benchmarks
- pmd-benchmarks
- spotbugs-benchmarks
script:
- DOCKER_TAG_NAME=$(echo $CI_COMMIT_REF_SLUG- | sed 's/^master-$//')
- docker build --pull -t $IMAGE_NAME ./$JAVA_PROJECT_NAME
- "[ ! $CI_COMMIT_TAG ] && docker tag $IMAGE_NAME $CR_HOST/$CR_ORG/$IMAGE_NAME:${DOCKER_TAG_NAME}latest"
- "[ ! $CI_COMMIT_TAG ] && docker tag $IMAGE_NAME $CR_HOST/$CR_ORG/$IMAGE_NAME:$DOCKER_TAG_NAME$CI_COMMIT_SHORT_SHA"
- "[ $CI_COMMIT_TAG ] && docker tag $IMAGE_NAME $CR_HOST/$CR_ORG/$IMAGE_NAME:$CI_COMMIT_TAG"
- echo $CR_PW | docker login $CR_HOST -u $CR_USER --password-stdin
- docker push $CR_HOST/$CR_ORG/$IMAGE_NAME
- docker logout
rules:
- if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW && $IMAGE_NAME && $JAVA_PROJECT_NAME && $CI_COMMIT_TAG"
when: always
- changes:
- theodolite-benchmarks/*
- theodolite-benchmarks/$JAVA_PROJECT_NAME/**/*
- theodolite-benchmarks/kstreams-commons/**/*
- theodolite-benchmarks/flink-commons/**/*
- theodolite-benchmarks/load-generator-commons/**/*
if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW && $IMAGE_NAME && $JAVA_PROJECT_NAME"
when: always
- if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW && $IMAGE_NAME && $JAVA_PROJECT_NAME"
when: manual
allow_failure: true
deploy-uc1-kstreams:
extends: .deploy-benchmarks
variables:
IMAGE_NAME: "theodolite-uc1-kstreams-app"
JAVA_PROJECT_NAME: "uc1-kstreams"
deploy-uc2-kstreams:
extends: .deploy-benchmarks
variables:
IMAGE_NAME: "theodolite-uc2-kstreams-app"
JAVA_PROJECT_NAME: "uc2-kstreams"
deploy-uc3-kstreams:
extends: .deploy-benchmarks
variables:
IMAGE_NAME: "theodolite-uc3-kstreams-app"
JAVA_PROJECT_NAME: "uc3-kstreams"
deploy-uc4-kstreams:
extends: .deploy-benchmarks
variables:
IMAGE_NAME: "theodolite-uc4-kstreams-app"
JAVA_PROJECT_NAME: "uc4-kstreams"
deploy-uc1-flink:
extends: .deploy-benchmarks
variables:
IMAGE_NAME: "theodolite-uc1-flink"
JAVA_PROJECT_NAME: "uc1-flink"
deploy-uc2-flink:
extends: .deploy-benchmarks
variables:
IMAGE_NAME: "theodolite-uc2-flink"
JAVA_PROJECT_NAME: "uc2-flink"
deploy-uc3-flink:
extends: .deploy-benchmarks
variables:
IMAGE_NAME: "theodolite-uc3-flink"
JAVA_PROJECT_NAME: "uc3-flink"
deploy-uc4-flink:
extends: .deploy-benchmarks
variables:
IMAGE_NAME: "theodolite-uc4-flink"
JAVA_PROJECT_NAME: "uc4-flink"
deploy-uc1-load-generator:
extends: .deploy-benchmarks
variables:
IMAGE_NAME: "theodolite-uc1-workload-generator"
JAVA_PROJECT_NAME: "uc1-load-generator"
deploy-uc2-load-generator:
extends: .deploy-benchmarks
variables:
IMAGE_NAME: "theodolite-uc2-workload-generator"
JAVA_PROJECT_NAME: "uc2-load-generator"
deploy-uc3-load-generator:
extends: .deploy-benchmarks
variables:
IMAGE_NAME: "theodolite-uc3-workload-generator"
JAVA_PROJECT_NAME: "uc3-load-generator"
deploy-uc4-load-generator:
extends: .deploy-benchmarks
variables:
IMAGE_NAME: "theodolite-uc4-workload-generator"
JAVA_PROJECT_NAME: "uc4-load-generator"
# Theodolite Framework
.theodolite:
image:
name: ghcr.io/graalvm/native-image:java11-21.1.0
entrypoint: [""]
tags:
- exec-docker
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
cache:
paths:
- .gradle/wrapper
- .gradle/caches
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
- cd theodolite-quarkus
build-theodolite-jvm:
stage: build
extends: .theodolite
script: ./gradlew --build-cache assemble
artifacts:
paths:
- "theodolite-quarkus/build/lib/*"
- "theodolite-quarkus/build/*-runner.jar"
expire_in: 6 hours
build-theodolite-native:
stage: build
extends: .theodolite
script:
- ./gradlew --build-cache assemble -Dquarkus.package.type=native
when: manual
artifacts:
paths:
- "theodolite-quarkus/build/*-runner"
expire_in: 6 hours
test-theodolite:
stage: test
extends: .theodolite
needs:
- build-theodolite-jvm
#- build-theodolite-native
script: ./gradlew test --stacktrace
artifacts:
reports:
junit:
- "theodolite-quarkus/**/build/test-results/test/TEST-*.xml"
# Disabled for now
.ktlint-theodolite:
stage: check
extends: .theodolite
needs:
- build-theodolite-jvm
- test-theodolite
script: ./gradlew ktlintCheck --continue
# Disabled for now
.detekt-theodolite:
stage: check
extends: .theodolite
needs:
- build-theodolite-jvm
- test-theodolite
script: ./gradlew detekt --continue
deploy-theodolite:
stage: deploy
extends:
- .theodolite
- .dind
needs:
#- build-theodolite-native
- build-theodolite-jvm
- test-theodolite
script:
- DOCKER_TAG_NAME=$(echo $CI_COMMIT_REF_SLUG- | sed 's/^master-$//')
#- docker build -f src/main/docker/Dockerfile.native -t theodolite .
- docker build -f src/main/docker/Dockerfile.jvm -t theodolite .
- "[ ! $CI_COMMIT_TAG ] && docker tag theodolite $CR_HOST/$CR_ORG/theodolite:${DOCKER_TAG_NAME}latest"
- "[ ! $CI_COMMIT_TAG ] && docker tag theodolite $CR_HOST/$CR_ORG/theodolite:$DOCKER_TAG_NAME$CI_COMMIT_SHORT_SHA"
- "[ $CI_COMMIT_TAG ] && docker tag theodolite $CR_HOST/$CR_ORG/theodolite:$CI_COMMIT_TAG"
- echo $CR_PW | docker login $CR_HOST -u $CR_USER --password-stdin
- docker push $CR_HOST/$CR_ORG/theodolite
- docker logout
rules:
- if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW && $CI_COMMIT_TAG"
when: always
- changes:
- theodolite-quarkus/**/*
if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW"
when: always
- if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW"
when: manual
allow_failure: true
# Theodolite SLO Checker: Lag Trend
test-slo-checker-lag-trend:
stage: test
image: python:3.7-slim
tags:
- exec-docker
script:
- cd slope-evaluator
- pip install -r requirements.txt
- cd app
- python -m unittest
deploy-slo-checker-lag-trend:
stage: deploy
extends:
- .dind
needs:
- test-slo-checker-lag-trend
script:
- DOCKER_TAG_NAME=$(echo $CI_COMMIT_REF_SLUG- | sed 's/^master-$//')
- docker build --pull -t theodolite-slo-checker-lag-trend slope-evaluator
- "[ ! $CI_COMMIT_TAG ] && docker tag theodolite-slo-checker-lag-trend $CR_HOST/$CR_ORG/theodolite-slo-checker-lag-trend:${DOCKER_TAG_NAME}latest"
- "[ $CI_COMMIT_TAG ] && docker tag theodolite-slo-checker-lag-trend $CR_HOST/$CR_ORG/theodolite-slo-checker-lag-trend:$CI_COMMIT_TAG"
- echo $CR_PW | docker login $CR_HOST -u $CR_USER --password-stdin
- docker push $CR_HOST/$CR_ORG/theodolite-slo-checker-lag-trend
- docker logout
rules:
- if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW && $CI_COMMIT_TAG"
when: always
- changes:
- slope-evaluator/**/*
if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW"
when: always
- if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW"
when: manual
allow_failure: true
# Theodolite Random Scheduler
deploy-random-scheduler:
stage: deploy
extends:
- .dind
needs: []
script:
- DOCKER_TAG_NAME=$(echo $CI_COMMIT_REF_SLUG- | sed 's/^master-$//')
- docker build --pull -t theodolite-random-scheduler execution/infrastructure/random-scheduler
- "[ ! $CI_COMMIT_TAG ] && docker tag theodolite-random-scheduler $CR_HOST/$CR_ORG/theodolite-random-scheduler:${DOCKER_TAG_NAME}latest"
- "[ $CI_COMMIT_TAG ] && docker tag theodolite-random-scheduler $CR_HOST/$CR_ORG/theodolite-random-scheduler:$CI_COMMIT_TAG"
- echo $CR_PW | docker login $CR_HOST -u $CR_USER --password-stdin
- docker push $CR_HOST/$CR_ORG/theodolite-random-scheduler
- docker logout
rules:
- if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW && $CI_COMMIT_TAG"
when: always
- changes:
- execution/infrastructure/random-scheduler/**/*
if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW"
when: always
- if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW"
when: manual
allow_failure: true