forked from hail-is/hail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.yaml
562 lines (562 loc) · 13.8 KB
/
build.yaml
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
steps:
- kind: createNamespace
name: default_ns
namespaceName: default
public: true
secrets:
- scorecard-github-access-token
- hail-vdc-sa-key
- notebook-secrets
- gcr-pull-key
- hail-ci-0-1-github-oauth-token
# hail|ci2
- user-jwt-fzp4f
- gsa-key-hnmrj
# hail|batch
- user-jwt-fh7kp
- gsa-key-n6hf9
- kind: deploy
name: deploy_batch_sa
namespace:
valueFrom: default_ns.name
config: batch/service-account.yaml
dependsOn:
- default_ns
- kind: createNamespace
name: batch_pods_ns
namespaceName: batch-pods
adminServiceAccount:
name: batch
namespace:
valueFrom: default_ns.name
public: false
secrets:
# hail|test-batch
- user-jwt-vkqfw
- gsa-key-2x975
dependsOn:
- default_ns
- deploy_batch_sa
- kind: buildImage
name: base_image
dockerFile: docker/Dockerfile.base
contextPath: docker
publishAs: base
- kind: buildImage
name: hail_build_image
dockerFile: hail/Dockerfile.hail-build
contextPath: hail
publishAs: hail-build
dependsOn:
- base_image
- kind: buildImage
name: hail_run_image
dockerFile: hail/Dockerfile.hail-run
contextPath: hail
publishAs: hail-run
dependsOn:
- base_image
- kind: buildImage
name: scorecard_image
dockerFile: scorecard/Dockerfile
contextPath: scorecard
publishAs: scorecard
dependsOn:
- base_image
- kind: buildImage
name: site_image
dockerFile: site/Dockerfile
contextPath: site
publishAs: site
dependsOn:
- base_image
- kind: buildImage
name: router_image
dockerFile: router/Dockerfile
contextPath: router
publishAs: router
dependsOn:
- base_image
- kind: buildImage
name: batch_image
dockerFile: batch/Dockerfile
contextPath: .
publishAs: batch
dependsOn:
- base_image
- kind: buildImage
name: test_batch_image
dockerFile: batch/Dockerfile.test
contextPath: .
publishAs: test-batch
dependsOn:
- base_image
- kind: buildImage
name: image_fetcher_image
dockerFile: image-fetcher/Dockerfile
contextPath: image-fetcher
publishAs: image-fetcher
- kind: buildImage
name: ci_image
dockerFile: ci2/Dockerfile
contextPath: .
publishAs: ci2
dependsOn:
- base_image
- kind: buildImage
name: ci_utils_image
dockerFile: ci2/Dockerfile.ci-utils
contextPath: ci2
publishAs: ci-utils
dependsOn:
- base_image
- kind: runImage
name: build_hail
image:
valueFrom: hail_build_image.image
script: |
set -ex
cd /io
rm -rf repo
mkdir repo
cd repo
{{ code.checkout_script }}
cd hail
./gradlew shadowJar
(cd python && zip -r hail.zip hail)
tar czf test.tar.gz -C python test
tar czf resources.tar.gz -C src/test resources
tar czf data.tar.gz -C python/hail/docs data
tar czf www-src.tar.gz www
tar czf cluster-tests.tar.gz create_config_file.py python/cluster-tests
outputs:
- from: /io/repo/hail/build/libs/hail-all-spark.jar
to: /hail-all-spark.jar
- from: /io/repo/hail/python/hail.zip
to: /hail.zip
- from: /io/repo/hail/test.tar.gz
to: /test.tar.gz
- from: /io/repo/hail/resources.tar.gz
to: /resources.tar.gz
- from: /io/repo/hail/data.tar.gz
to: /data.tar.gz
- from: /io/repo/hail/www-src.tar.gz
to: /www-src.tar.gz
- from: /io/repo/hail/cluster-tests.tar.gz
to: /cluster-tests.tar.gz
dependsOn:
- hail_build_image
- kind: buildImage
name: hail_base_image
dockerFile: apiserver/Dockerfile.hail-base
contextPath: .
publishAs: hail-base
dependsOn:
- hail_run_image
- build_hail
inputs:
- from: /hail-all-spark.jar
to: /hail-all-spark.jar
- from: /hail.zip
to: /hail.zip
- kind: buildImage
name: apiserver_image
dockerFile: apiserver/Dockerfile.apiserver
contextPath: .
publishAs: apiserver
dependsOn:
- hail_base_image
- kind: buildImage
name: hail_jupyter_image
dockerFile: apiserver/Dockerfile.hail-jupyter
contextPath: .
publishAs: hail-jupyter
dependsOn:
- hail_base_image
- kind: buildImage
name: spark_master_image
dockerFile: apiserver/Dockerfile.spark-master
contextPath: apiserver
publishAs: spark-master
dependsOn:
- hail_base_image
- kind: buildImage
name: spark_worker_image
dockerFile: apiserver/Dockerfile.spark-worker
contextPath: apiserver
publishAs: spark-worker
dependsOn:
- hail_base_image
- kind: buildImage
name: test_apiserver_image
dockerFile: apiserver/Dockerfile.test-apiserver
contextPath: .
publishAs: test-apiserver
inputs:
- from: /test.tar.gz
to: /test.tar.gz
- from: /resources.tar.gz
to: /resources.tar.gz
- from: /data.tar.gz
to: /data.tar.gz
dependsOn:
- hail_base_image
- build_hail
- kind: buildImage
name: notebook2_image
dockerFile: notebook2/Dockerfile
contextPath: .
publishAs: notebook2
dependsOn:
- base_image
- kind: runImage
name: test_hail_python
image:
valueFrom: hail_run_image.image
script: |
set -ex
cd /io
tar xzf test.tar.gz
tar xzf resources.tar.gz
tar xzf data.tar.gz
export HAIL_TEST_RESOURCES_DIR=./resources
export HAIL_DOCTEST_DATA_DIR=./data
export PYSPARK_SUBMIT_ARGS="--conf spark.driver.extraClassPath=./hail-all-spark.jar --conf spark.executor.extraClassPath=./hail-all-spark.jar pyspark-shell"
export PYTHONPATH=${PYTHONPATH:+${PYTHONPATH}:}./hail.zip
python3 -m pytest test
inputs:
- from: /hail-all-spark.jar
to: /io/hail-all-spark.jar
- from: /hail.zip
to: /io/hail.zip
- from: /test.tar.gz
to: /io/test.tar.gz
- from: /resources.tar.gz
to: /io/resources.tar.gz
- from: /data.tar.gz
to: /io/data.tar.gz
dependsOn:
- hail_run_image
- build_hail
- kind: runImage
name: test_python_docs
image:
valueFrom: hail_base_image.image
script: |
set -ex
cd /hail/python/hail
python3 -m pytest \
--doctest-modules \
--doctest-glob='*.rst' \
--ignore=docs/conf.py \
--ignore=docs/doctest_write_data.py
dependsOn:
- hail_base_image
- kind: runImage
name: test_dataproc
image:
valueFrom: base_image.image
script: |
set -ex
# FIXME use local cloudtools
python3 -m pip install -U cloudtools==4.0.0
gcloud auth activate-service-account --key-file=/secrets/ci-secrets/hail-ci-0-1.key
gcloud config set project broad-ctsa
SCRATCH=gs://hail-ci-0-1/temp/{{ token }}
time gsutil cp \
/io/hail-all-spark.jar \
$SCRATCH/hail.jar
time gsutil cp \
/io/hail.zip \
$SCRATCH/hail.zip
tar xzf /io/cluster-tests.tar.gz
python3 ./create_config_file.py 0.2 config.json
CLUSTER=ci-test-{{ token }}
time cluster start $CLUSTER \
--master-machine-type n1-standard-1 \
--master-boot-disk-size 40 \
--worker-machine-type n1-standard-1 \
--worker-boot-disk-size 40 \
--version 0.2 \
--spark 2.4.0 \
--max-idle 10m \
--bucket hail-ci-0-1-dataproc-staging-bucket \
--config-file config.json \
--hash {{ code.sha }} \
--jar $SCRATCH/hail.jar \
--zip $SCRATCH/hail.zip \
--vep
for SCRIPT in python/cluster-tests/*.py; do
time cluster submit $CLUSTER $SCRIPT
done
time gsutil rm -rf $SCRATCH
time cluster stop $CLUSTER --async
secrets:
- name: hail-ci-0-1-service-account-key
mountPath: /secrets/ci-secrets
inputs:
- from: /hail.zip
to: /io/hail.zip
- from: /hail-all-spark.jar
to: /io/hail-all-spark.jar
- from: /cluster-tests.tar.gz
to: /io/cluster-tests.tar.gz
dependsOn:
- base_image
- build_hail
- kind: runImage
name: cleanup_dataproc
image:
valueFrom: base_image.image
script: |
set -x
gcloud auth activate-service-account --key-file=/secrets/ci-secrets/hail-ci-0-1.key
gcloud config set project broad-ctsa
time gsutil rm -rf gs://hail-ci-0-1/temp/{{ test_dataproc.token }}
time gcloud -q dataproc clusters delete --async ci-test-{{ test_dataproc.token }}
true
secrets:
- name: hail-ci-0-1-service-account-key
mountPath: /secret/ci-secrets
alwaysRun: true
dependsOn:
- base_image
- test_dataproc
- kind: runImage
name: make_docs
image:
valueFrom: hail_base_image.image
script: |
set -ex
export HAIL_SHORT_VERSION='0.2'
export SPHINXOPTS='-tchecktutorial'
cd /io
unzip -q hail.zip
# docs refer to www, maintain standard relationship
mkdir python
mv hail python
tar xzf www-src.tar.gz
sed -E "s/\(hail\#([0-9]+)\)/(\[#\1](https:\/\/github.com\/hail-is\/hail\/pull\/\1))/g" \
< python/hail/docs/change_log.md \
| pandoc -o python/hail/docs/change_log.rst
make -C www
make -C python/hail/docs BUILDDIR=_build clean html
mkdir -p www/docs
mv python/hail/docs/_build/html www/docs/0.2
tar czf www.tar.gz www
inputs:
- from: /hail.zip
to: /io/hail.zip
- from: /www-src.tar.gz
to: /io/www-src.tar.gz
outputs:
- from: /io/www.tar.gz
to: /www.tar.gz
dependsOn:
- hail_base_image
- build_hail
- kind: deploy
name: deploy_router
namespace:
valueFrom: default_ns.name
config: router/deployment.yaml
link:
- www
- scorecard
- notebook2
- ci2
- upload
dependsOn:
- default_ns
- router_image
- kind: deploy
name: deploy_site
namespace:
valueFrom: default_ns.name
config: site/deployment.yaml
dependsOn:
- default_ns
- site_image
- deploy_router
- kind: deploy
name: deploy_scorecard
namespace:
valueFrom: default_ns.name
config: scorecard/deployment.yaml
dependsOn:
- default_ns
- scorecard_image
- deploy_router
- kind: deploy
name: deploy_ci
namespace:
valueFrom: default_ns.name
config: ci2/deployment.yaml
wait:
- kind: Service
name: ci2
for: alive
dependsOn:
- default_ns
- ci_image
- ci_utils_image
- kind: createDatabase
name: batch_database
databaseName: batch
namespace:
valueFrom: default_ns.name
dependsOn:
- default_ns
- kind: buildImage
name: create_batch_tables_image
dockerFile: batch/Dockerfile.create-tables
contextPath: batch
dependsOn:
- base_image
- kind: deploy
name: create_batch_tables
namespace:
valueFrom: default_ns.name
config: batch/create-batch-tables-pod.yaml
wait:
- kind: Pod
name: create-batch-tables
for: completed
dependsOn:
- default_ns
- create_batch_tables_image
- batch_database
- kind: deploy
name: create_batch_tables_2
namespace:
valueFrom: default_ns.name
config: batch/create-batch-tables-pod.yaml
wait:
- kind: Pod
name: create-batch-tables
for: completed
dependsOn:
- default_ns
- create_batch_tables_image
- batch_database
- create_batch_tables
- kind: deploy
name: deploy_batch
namespace:
valueFrom: default_ns.name
config: batch/deployment.yaml
wait:
- kind: Service
name: batch
for: alive
dependsOn:
- default_ns
- batch_pods_ns
- batch_image
- batch_database
- create_batch_tables
- kind: deploy
name: deploy_image_fetcher
namespace:
valueFrom: default_ns.name
config: image-fetcher/deployment.yaml
dependsOn:
- default_ns
- image_fetcher_image
- kind: deploy
name: test_batch
namespace:
valueFrom: batch_pods_ns.name
config: batch/test-batch-pod.yaml
wait:
- kind: Pod
name: test-batch
for: completed
dependsOn:
- default_ns
- batch_pods_ns
- deploy_batch
- test_batch_image
- kind: deploy
name: deploy_apiserver
namespace:
valueFrom: default_ns.name
config: apiserver/deployment.yaml
wait:
- kind: Deployment
name: spark-master
for: available
- kind: Deployment
name: spark-worker
for: available
- kind: Service
name: apiserver
port: 5000
for: alive
dependsOn:
- default_ns
- test_batch_image
- spark_master_image
- spark_worker_image
- apiserver_image
- kind: deploy
name: test_apiserver
namespace:
valueFrom: batch_pods_ns.name
config: apiserver/test-apiserver-pod.yaml
wait:
- kind: Pod
name: test-apiserver
for: completed
dependsOn:
- default_ns
- batch_pods_ns
- test_apiserver_image
- deploy_apiserver
- kind: deploy
name: deploy_notebook2
namespace:
valueFrom: default_ns.name
config: notebook2/deployment.yaml
dependsOn:
- default_ns
- notebook2_image
- hail_jupyter_image
- deploy_router
- kind: runImage
name: create_ci_test_repo
image:
valueFrom: base_image.image
script: |
set -e
TOKEN=$(cat /secret/ci-secrets/user1)
echo creating ci-test-{{ token }}...
curl -XPOST \
-i \
https://api.github.com/orgs/hail-ci-test/repos \
-H "Authorization: token ${TOKEN}" \
-d "{ \"name\" : \"ci-test-{{ token }}\" }"
secrets:
- name: hail-ci-0-1-service-account-key
mountPath: /secret/ci-secrets
dependsOn:
- base_image
- kind: runImage
name: cleanup_ci_test_repo
image:
valueFrom: base_image.image
script: |
set -e
TOKEN=$(cat /secret/ci-secrets/user1)
echo deleting ci-test-{{ create_ci_test_repo.token }}...
curl -XDELETE \
-i \
https://api.github.com/repos/hail-ci-test/ci-test-{{ create_ci_test_repo.token }} \
-H "Authorization: token ${TOKEN}"
secrets:
- name: hail-ci-0-1-service-account-key
mountPath: /secret/ci-secrets
alwaysRun: true
dependsOn:
- base_image
- create_ci_test_repo