forked from dotmesh-io/dotmesh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
602 lines (559 loc) · 14.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
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
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
# TODO: try to clean up test runs by wrapping go test in a timeout & running
# the cleanup scripts.
# I think we'll need to pass in a name to the test runner, and then cleanup
# anything with that prefix...
variables:
SERVER_NAME: dotmesh-server
PROVISIONER_NAME: dotmesh-dynamic-provisioner
CI_REGISTRY: registry.gitlab.dotmesh.com
CI_REPOSITORY: dotmesh/dotmesh-sync
RELEASE_DOCKER_REGISTRY: quay.io
RELEASE_DOCKER_REPOSITORY: dotmesh
CI_DOCKER_TAG: $CI_COMMIT_SHA
# PLEASE NOTE: If you change these, you also need to update the BUILD.bazel files in those projects
# to make their docker_push thingies match - they don't automatically remain in sync.
STABLE_CI_DOCKER_SERVER_IMAGE: $CI_REGISTRY/$CI_REPOSITORY/dotmesh-server:$CI_COMMIT_SHA
CI_DOCKER_PROVISIONER_IMAGE: $CI_REGISTRY/$CI_REPOSITORY/dotmesh-dynamic-provisioner:$CI_COMMIT_SHA
CI_DOCKER_OPERATOR_IMAGE: $CI_REGISTRY/$CI_REPOSITORY/dotmesh-operator:$CI_COMMIT_SHA
CI_DOCKER_DIND_PROVISIONER_IMAGE: $CI_REGISTRY/$CI_REPOSITORY/dind-dynamic-provisioner:$CI_COMMIT_SHA
CI_SERVICE_BEING_TESTED: dotmesh
DOTMESH_TEST_CLEANUP: always
DOTMESH_TEST_TIMEOUT: 10m
stages:
- build
- test
- deploy_images
- deploy
- smoke
- manual_deploy
- notify
before_script:
- mkdir -p gopath
- export GOPATH=$(pwd)/gopath
- cd gopath
- mkdir -p src/github.com/dotmesh-io
- ln -s `realpath ..` ./src/github.com/dotmesh-io/dotmesh
- cd src/github.com/dotmesh-io/dotmesh
# ensure master and the given branch are up-to-date so that versioner works reliably
- git checkout master && git pull --ff-only origin master
- git checkout $CI_COMMIT_REF_NAME && git reset --hard $CI_COMMIT_SHA
- while [ -f /dotmesh-test-cleanup.lock ]; do echo "waiting for test cleanup..."; sleep 1; done
build_client_linux:
retry: 2
stage: build
tags:
- ubuntu-bionic
- fast
script:
- ./rebuild_client.sh Linux
artifacts:
paths:
- binaries
expire_in: 1 week
except:
- schedules
build_client_macos:
retry: 2
stage: build
tags:
- ubuntu-bionic
- fast
script:
- ./rebuild_client.sh Darwin
artifacts:
paths:
- binaries
expire_in: 1 week
except:
- schedules
build_yaml:
retry: 2
stage: build
tags:
- ubuntu-bionic
- fast
script:
- (cd kubernetes && ./rebuild.sh)
artifacts:
paths:
- yaml
expire_in: 1 week
except:
- schedules
.build_without_bazel:
retry: 2
stage: build
tags:
- ubuntu-bionic
- fast
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- ./rebuild_in_container_without_bazel.sh --push Linux
artifacts:
paths:
- target
expire_in: 1 week
except:
- schedules
build_operator:
retry: 2
stage: build
tags:
- ubuntu-bionic
- fast
script:
# push to the CI registry
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- (./rebuild_operator.sh) # also pushes
- echo "pushed $CI_DOCKER_OPERATOR_IMAGE"
artifacts:
paths:
- target
expire_in: 1 week
except:
- schedules
build_provisioner:
retry: 2
stage: build
tags:
- ubuntu-bionic
- fast
script:
# push to the CI registry
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- (./rebuild_provisioner.sh) # also pushes
- echo "pushed $CI_DOCKER_PROVISIONER_IMAGE"
artifacts:
paths:
- target
expire_in: 1 week
except:
- schedules
build_server:
retry: 2
stage: build
tags:
- ubuntu-bionic
- fast
script:
# push to the CI registry
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- (./rebuild_server.sh) # also pushes
- echo "pushed $CI_DOCKER_SERVER_IMAGE"
- echo "pushed $CI_DOCKER_DIND_PROVISIONER_IMAGE"
artifacts:
paths:
- target
expire_in: 1 week
except:
- schedules
macos_docker_stable_smoke:
retry: 2
stage: smoke
tags:
- macos
- docker-stable
script:
- gtimeout 5m ./scripts/smoke.sh
after_script:
- docker container prune -f
macos_docker_edge_smoke:
retry: 2
stage: smoke
tags:
- macos
- docker-edge
script:
- gtimeout 5m ./scripts/smoke.sh
after_script:
- docker container prune -f
linux_smoke:
retry: 2
stage: smoke
tags:
- ubuntu-bionic
- fast
script:
- timeout 5m ./scripts/smoke.sh
after_script:
- docker container prune -f
dotmesh_unit_tests:
stage: test
tags:
- ubuntu-bionic
- fast
script:
- go test `go list ./... | egrep -v /tests`
except:
- schedules
versioner_unit_tests:
stage: test
tags:
- ubuntu-bionic
- fast
script:
- cd cmd/versioner && go test
except:
- schedules
# run full dind tests on linux
linux_default_dot:
retry: 2
stage: test
dependencies:
- build_client_linux
tags:
- ubuntu-bionic
- fast
script:
- ./test.sh -run TestDefaultDot
artifacts:
paths:
- extracted_logs
when: always
except:
- schedules
linux_single_node:
retry: 2
stage: test
dependencies:
- build_client_linux
tags:
- ubuntu-bionic
- fast
script:
- ./test.sh -run TestSingleNode
artifacts:
paths:
- extracted_logs
when: always
except:
- schedules
linux_recover_from_unmounted_dot_on_master:
retry: 2
stage: test
dependencies:
- build_client_linux
tags:
- ubuntu-bionic
- fast
script:
- ./test.sh -run TestRecoverFromUnmountedDotOnMaster
artifacts:
paths:
- extracted_logs
when: always
except:
- schedules
linux_two_nodes_same_cluster:
retry: 2
stage: test
dependencies:
- build_client_linux
tags:
- ubuntu-bionic
- fast
script:
- ./test.sh -run TestTwoNodesSameCluster
artifacts:
paths:
- extracted_logs
when: always
except:
- schedules
linux_kubernetes_volumes:
retry: 2
stage: test
dependencies:
- build_yaml
- build_client_linux
tags:
- ubuntu-bionic
- fast
script:
- ./test.sh -run TestKubernetesVolumes
artifacts:
paths:
- extracted_logs
when: always
except:
- schedules
linux_kubernetes_operator_dynamic_provisioning:
retry: 2
stage: test
dependencies:
- build_yaml
- build_client_linux
- build_server
tags:
- ubuntu-bionic
- fast
script:
- DOTMESH_TEST_TIMEOUT=15m ./test.sh -run TestKubernetesOperator/DynamicProvisioning
artifacts:
paths:
- extracted_logs
when: always
except:
- schedules
linux_kubernetes_operator_PVC:
retry: 2
stage: test
dependencies:
- build_yaml
- build_client_linux
- build_server
tags:
- ubuntu-bionic
- fast
script:
- ./test.sh -run TestKubernetesOperator/PVC*
artifacts:
paths:
- extracted_logs
when: always
except:
- schedules
linux_deletion_simple:
retry: 2
stage: test
dependencies:
- build_client_linux
tags:
- ubuntu-bionic
- fast
script:
- ./test.sh -run TestDeletionSimple
artifacts:
paths:
- extracted_logs
when: always
except:
- schedules
linux_deletion_complex:
retry: 2
stage: test
dependencies:
- build_client_linux
tags:
- ubuntu-bionic
- fast
script:
- ./test.sh -run TestDeletionComplex
artifacts:
paths:
- extracted_logs
when: always
except:
- schedules
linux_backup_and_restore_two_single_node_clusters:
retry: 2
stage: test
dependencies:
- build_client_linux
tags:
- ubuntu-bionic
- fast
script:
- ./test.sh -run TestBackupAndRestoreTwoSingleNodeClusters
artifacts:
paths:
- extracted_logs
when: always
except:
- schedules
linux_two_single_node_clusters:
retry: 2
stage: test
dependencies:
- build_client_linux
tags:
- ubuntu-bionic
- fast
script:
- ./test.sh -run TestTwoSingleNodeClusters
artifacts:
paths:
- extracted_logs
when: always
except:
- schedules
linux_three_single_node_clusters:
retry: 2
stage: test
dependencies:
- build_client_linux
tags:
- ubuntu-bionic
- fast
script:
- ./test.sh -run TestThreeSingleNodeClusters
artifacts:
paths:
- extracted_logs
when: always
except:
- schedules
linux_two_double_node_clusters:
retry: 2
stage: test
dependencies:
- build_client_linux
tags:
- ubuntu-bionic
- fast
script:
- ./test.sh -run TestTwoDoubleNodeClusters
artifacts:
paths:
- extracted_logs
when: always
except:
- schedules
.linux_s3:
retry: 2
stage: test
dependencies:
- build_client_linux
tags:
- ubuntu-bionic
- fast
script:
- ./test.sh -run TestS3Remote
artifacts:
paths:
- extracted_logs
when: always
except:
- schedules
# Test disabled while we rethink how it works (see comments in acceptance_test.go)
.linux_kubernetes_test_tooling:
retry: 2
stage: test
dependencies:
- build_client_linux
tags:
- ubuntu-bionic
- fast
script:
- ./test.sh -run TestKubernetesTestTooling
artifacts:
paths:
- extracted_logs
when: always
except:
- schedules
linux_stress_lots_of_commits:
retry: 2
stage: test
dependencies:
- build_client_linux
tags:
- ubuntu-bionic
- fast
script:
- DOTMESH_TEST_TIMEOUT=30m ./test.sh -run TestStressLotsOfCommits
artifacts:
paths:
- extracted_logs
when: always
when: manual
except:
- schedules
linux_stress_handover:
retry: 2
stage: test
dependencies:
- build_client_linux
tags:
- ubuntu-bionic
- fast
script:
- DOTMESH_TEST_TIMEOUT=30m ./test.sh -run TestStressHandover
artifacts:
paths:
- extracted_logs
when: always
when: manual
except:
- schedules
publish_images:
stage: deploy_images
dependencies:
- build_client_linux
- build_client_macos
- build_server
- build_yaml
tags:
- ubuntu-bionic
- fast
script:
# push to quay.io, by re-tagging and pushing the images
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker login -u $QUAY_USER -p $QUAY_PASSWORD $RELEASE_DOCKER_REGISTRY
- ./release-images.sh $RELEASE_DOCKER_REGISTRY $RELEASE_DOCKER_REPOSITORY
except:
- schedules
trigger_e2e_test:
stage: deploy
tags:
- ubuntu-bionic
- fast
script:
- echo - curl -X POST -F "token=$E2E_TRIGGER_TOKEN" -F "ref=master" -F "variables[DOTMESH_CI_COMMIT_SHA]=$CI_COMMIT_SHA" -F "variables[DOTMESH_CI_BUILD_REF_NAME]=$CI_BUILD_REF_NAME" https://gitlab.dotmesh.com/api/v4/projects/31/trigger/pipeline
- curl -X POST -F "token=$E2E_TRIGGER_TOKEN" -F "ref=master" -F "variables[DOTMESH_CI_COMMIT_SHA]=$CI_COMMIT_SHA" -F "variables[DOTMESH_CI_BUILD_REF_NAME]=$CI_BUILD_REF_NAME" https://gitlab.dotmesh.com/api/v4/projects/31/trigger/pipeline
only:
- master
except:
- schedules
deploy_unstable_build:
stage: deploy
dependencies:
- build_client_linux
- build_client_macos
- build_yaml
- publish_images
tags:
- ubuntu-bionic
- fast
script:
- "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [email protected] mkdir -p /pool/releases/unstable/$CI_COMMIT_REF_NAME"
- "rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' -avz binaries/{Linux,Darwin} yaml [email protected]:/pool/releases/unstable/$CI_COMMIT_REF_NAME"
- "echo \"Deployed to https://get.dotmesh.io/unstable/$CI_COMMIT_REF_NAME\""
except:
- /^release-.*$/
- schedules
deploy_release_build:
stage: deploy
dependencies:
- build_client_linux
- build_client_macos
- build_yaml
- publish_images
tags:
- ubuntu-bionic
- fast
script:
- VERSION=`cd cmd/versioner; go run versioner.go`; echo VERSION=$VERSION
- "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [email protected] mkdir -p /pool/releases/$VERSION"
- "rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' -avz binaries/{Linux,Darwin} yaml [email protected]:/pool/releases/$VERSION"
only:
- /^release-.*$/
except:
- schedules
mark_release_as_stable:
stage: manual_deploy
script:
- VERSION=`cd cmd/versioner; go run versioner.go`
- "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [email protected] sh -c \"true && rm -f /pool/releases/Linux && ln -s $VERSION/Linux /pool/releases && rm -f /pool/releases/Darwin && ln -s $VERSION/Darwin /pool/releases && rm -f /pool/releases/yaml && ln -fs $VERSION/yaml /pool/releases\""
only:
- /^release-.*$/
when: manual
except:
- schedules
notify_smoke_test_failure:
stage: notify
script:
- "curl -X POST -H 'Content-type: application/json' --data \"{\\\"text\\\":\\\"ALERT, Smoke tests failed $CI_PROJECT_URL/pipelines/$CI_PIPELINE_ID\\\"}\" $SLACK_WEBHOOK_URL"
when: on_failure
only:
- schedules