-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy path.drone.yml
1086 lines (1013 loc) · 29.4 KB
/
.drone.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
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
#NOTE: Leaving these here to try again eventually. The Yaml library drone 1.1.0
# uses has a bug with how it handles these anchors. Workaround is to be more
# verbose in the steps.
#
#__buildenv:
# image: "casperlabs/buildenv:latest"
#
#__sbtenv:
# environment:
# - "_JAVA_OPTIONS=-Xms2G -Xmx2G -XX:MaxMetaspaceSize=1G"
# image: "casperlabs/buildenv:latest"
# volumes:
# - "/var/cache/cl-build/.sbt:/root/.sbt"
# - "/var/cache/cl-build/.ivy2:/root/.ivy2"
# - "/var/cache/cl-build/.coursier:/root/.coursier"
# Begin
clone:
git-clone:
commands: |
set -ex
git clone -b ${DRONE_TAG:-$DRONE_BRANCH} $DRONE_REMOTE_URL .
if [ x$DRONE_PULL_REQUEST != x ]; then
git fetch origin refs/pull/$DRONE_PULL_REQUEST/head
EMAIL=ci git merge --no-edit FETCH_HEAD
fi
git rev-parse HEAD
image: "casperlabs/buildenv:latest"
#NOTE: 1. Had to remove cached .sbt/.ivy2 dirs for drone autoscaling. This is because
# drone uses docker bind mounts which do not create the host dir if it is nonexistent,
# resulting in Error response from daemon: invalid mount config for type "bind":
# bind source path does not exist: /var/cache/cl-build/.sbt
kind: pipeline
name: build-bors-merge
steps:
# Below is for pull_request webhooks only
#NOTE: allowing failures here since we've seen site temporarily go down and cause
# our pipeline to fail.
- name: markdown-link-check
commands:
- "ci/markdown-link-check.sh"
image: "casperlabs/buildenv:latest"
failure: "ignore"
when:
event:
- pull_request
changeset:
includes:
- "**/.drone.yml"
- "**/**.md"
- name: sbt-compile-test-pr
commands:
- "sbt test"
environment:
_JAVA_OPTIONS: "-Xms2G -Xmx2G -XX:MaxMetaspaceSize=1G"
image: "casperlabs/buildenv:latest"
when:
event:
- pull_request
changeset:
includes:
- "**/.drone.yml"
- "**/**.scala"
- "**/**.sbt"
- "**/**.proto"
- "**/casperlabs-node.service"
- name: git-status-post-scala-compile-pr
commands:
- STATUS_CHECK=$(git status)
- if echo $STATUS_CHECK | grep -q "modified" ; then echo "$STATUS_CHECK"; exit 1; fi
image: "casperlabs/buildenv:latest"
when:
event:
- pull_request
changeset:
includes:
- "**/.drone.yml"
- "**/**.scala"
- "**/**.sbt"
- "**/**.proto"
- "**/casperlabs-node.service"
depends_on:
- sbt-compile-test-pr
- name: rust-compile-test-pr
commands:
- "cd execution-engine/"
- "make setup-rs"
- "make test-rs test-contracts-rs"
image: "casperlabs/buildenv:latest"
when:
event:
- pull_request
changeset:
includes:
- "**/.drone.yml"
- "**/**.rs"
- "**/**.proto"
- "**/Cargo.lock"
- "**/Cargo.toml"
- "**/casperlabs-engine-grpc-server.spec"
- "**/rustfmt.toml"
- name: rust-compile-test-latest-nightly-pr
environment:
CARGO_OPTS: +nightly
commands:
- "cd execution-engine/"
- "make setup-nightly-rs"
- "make build CARGO_FLAGS=--all-targets"
- "make build-contracts-rs"
image: "casperlabs/buildenv:latest"
failure: "ignore"
when:
event:
- pull_request
changeset:
includes:
- "**/.drone.yml"
- "**/**.rs"
- "**/**.proto"
- "**/Cargo.lock"
- "**/Cargo.toml"
- "**/casperlabs-engine-grpc-server.spec"
- "**/rustfmt.toml"
- name: rust-compile-docs-stable-pr
commands:
- "cd execution-engine/"
- "make setup-stable-rs"
- "make build-docs-stable-rs"
image: "casperlabs/buildenv:latest"
failure: "ignore"
when:
event:
- pull_request
changeset:
includes:
- "**/.drone.yml"
- "**/**.rs"
- "**/**.proto"
- "**/Cargo.lock"
- "**/Cargo.toml"
- "**/casperlabs-engine-grpc-server.spec"
- "**/rustfmt.toml"
- name: as-compile-test-pr
commands:
- "cd execution-engine"
- "make setup"
- "make build-contracts-rs"
- "make test-as test-contracts-as"
image: "casperlabs/buildenv:latest"
when:
event:
- pull_request
changeset:
includes:
- "**/engine-core/**"
- "**/contract-as/**"
- "**/contracts-as/**"
- name: run-cargo-fmt-pr
commands:
- "cd execution-engine"
- "~/.cargo/bin/rustup toolchain install $(cat rust-toolchain)"
- "make check-format"
image: "casperlabs/buildenv:latest"
when:
event:
- pull_request
changeset:
includes:
- "**/.drone.yml"
- "**/**.rs"
- "**/**.proto"
- "**/Cargo.lock"
- "**/Cargo.toml"
- "**/casperlabs-engine-grpc-server.spec"
- "**/rustfmt.toml"
depends_on:
- rust-compile-test-pr
- name: run-rust-lints-pr
commands:
- "cd execution-engine"
- "make setup-rs"
- "make lint"
image: "casperlabs/buildenv:latest"
when:
event:
- pull_request
changeset:
includes:
- "**/.drone.yml"
- "**/**.rs"
- "**/**.proto"
- "**/Cargo.lock"
- "**/Cargo.toml"
- "**/casperlabs-engine-grpc-server.spec"
- "**/rustfmt.toml"
depends_on:
- rust-compile-test-pr
- name: run-rust-audit-pr
commands:
- "cd execution-engine"
- "make setup-audit"
- "make audit"
image: "casperlabs/buildenv:latest"
when:
event:
- pull_request
changeset:
includes:
- "**/.drone.yml"
- "**/**.rs"
- "**/**.proto"
- "**/Cargo.lock"
- "**/Cargo.toml"
depends_on:
- rust-compile-test-pr
# This section is for bors' branches only
#NOTE: allowing failures here since we've seen site temporarily go down and cause
# our pipeline to fail.
- name: markdown-link-check-bors
commands:
- "ci/markdown-link-check.sh"
image: "casperlabs/buildenv:latest"
failure: "ignore"
when:
branch:
- staging
- trying
changeset:
includes:
- "**/.drone.yml"
- "**/**.md"
- name: sbt-test-docker-bors
commands:
- "sbt test"
- "export DOCKER_LATEST_TAG=DRONE-${DRONE_BUILD_NUMBER}"
- "make docker-build/node"
environment:
_JAVA_OPTIONS: "-Xms2G -Xmx2G -XX:MaxMetaspaceSize=1G"
image: "casperlabs/buildenv:latest"
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
when:
branch:
- staging
- trying
- name: git-status-post-scala-compile-bors
commands:
- STATUS_CHECK=$(git status)
- if echo $STATUS_CHECK | grep -q "modified" ; then echo "$STATUS_CHECK"; exit 1; fi
image: "casperlabs/buildenv:latest"
when:
branch:
- staging
- trying
changeset:
includes:
- "**/.drone.yml"
- "**/**.scala"
- "**/**.sbt"
- "**/**.proto"
- "**/casperlabs-node.service"
depends_on:
- sbt-test-docker-bors
#Adding dependency on sbt due to sbt hanging frequently running in parallel with this step
- name: rust-compile-test-bors
commands:
- "cd execution-engine/"
- "make setup"
- "make test"
image: "casperlabs/buildenv:latest"
when:
branch:
- staging
- trying
depends_on:
- sbt-test-docker-bors
# Note: Added the dependency on the sbt step to be finished first because in testing,
# Drone was getting random sbt build failures when too many steps were running simultaneously.
- name: run-cargo-fmt-bors
commands:
- "cd execution-engine"
- "~/.cargo/bin/rustup toolchain install $(cat rust-toolchain)"
- "make check-format"
image: "casperlabs/buildenv:latest"
when:
branch:
- staging
- trying
changeset:
includes:
- "**/.drone.yml"
- "**/**.rs"
- "**/**.proto"
- "**/Cargo.lock"
- "**/Cargo.toml"
- "**/casperlabs-engine-grpc-server.spec"
- "**/rustfmt.toml"
depends_on:
- rust-compile-test-bors
- sbt-test-docker-bors
- name: run-rust-lints-bors
commands:
- "cd execution-engine"
- "make setup-rs"
- "make lint"
image: "casperlabs/buildenv:latest"
when:
branch:
- staging
- trying
changeset:
includes:
- "**/.drone.yml"
- "**/**.rs"
- "**/**.proto"
- "**/Cargo.lock"
- "**/Cargo.toml"
- "**/casperlabs-engine-grpc-server.spec"
- "**/rustfmt.toml"
depends_on:
- rust-compile-test-bors
- sbt-test-docker-bors
- name: run-rust-audit-bors
commands:
- "cd execution-engine"
- "make setup-audit"
- "make audit"
image: "casperlabs/buildenv:latest"
when:
branch:
- staging
- trying
changeset:
includes:
- "**/.drone.yml"
- "**/**.rs"
- "**/**.proto"
- "**/Cargo.lock"
- "**/Cargo.toml"
depends_on:
- rust-compile-test-bors
- sbt-test-docker-bors
- name: run-rust-benchmarks-bors
commands:
- "cd execution-engine"
- "make setup-rs"
- "make bench"
image: "casperlabs/buildenv:latest"
when:
branch:
- staging
- trying
changeset:
includes:
- "**/.drone.yml"
- "**/**.rs"
- "**/**.proto"
- "**/Cargo.lock"
- "**/Cargo.toml"
- "**/casperlabs-engine-grpc-server.spec"
- "**/rustfmt.toml"
depends_on:
- rust-compile-test-bors
- sbt-test-docker-bors
- name: run-casperlabs-updater-dry-bors
commands:
- "cd ci/casperlabs-updater"
- "cargo run --release -- --dry-run"
image: "casperlabs/buildenv:latest"
when:
branch:
- staging
- trying
changeset:
includes:
- "**/.drone.yml"
- "**/**.rs"
- "**/**.proto"
- "**/Cargo.lock"
- "**/Cargo.toml"
- "**/ci/casperlabs-updater/**"
depends_on:
- rust-compile-test-bors
- sbt-test-docker-bors
- name: docker-build-ee-bors
commands:
- "export DOCKER_LATEST_TAG=DRONE-${DRONE_BUILD_NUMBER}"
- "make docker-build/execution-engine"
environment:
_JAVA_OPTIONS: "-Xms2G -Xmx2G -XX:MaxMetaspaceSize=1G"
image: "casperlabs/buildenv:latest"
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
when:
branch:
- staging
- trying
depends_on:
- rust-compile-test-bors
- sbt-test-docker-bors
- name: docker-build-key-bors
commands:
- "export DOCKER_LATEST_TAG=DRONE-${DRONE_BUILD_NUMBER}"
- "make docker-build/key-generator"
environment:
_JAVA_OPTIONS: "-Xms2G -Xmx2G -XX:MaxMetaspaceSize=1G"
image: "casperlabs/buildenv:latest"
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
when:
branch:
- staging
- trying
changeset:
includes:
- "**/.drone.yml"
- "hack/key-management/**"
depends_on:
- rust-compile-test-bors
- sbt-test-docker-bors
- name: docker-build-explorer-bors
commands:
- "export DOCKER_LATEST_TAG=DRONE-${DRONE_BUILD_NUMBER}"
- "~/.cargo/bin/rustup toolchain install $(cat execution-engine/rust-toolchain)"
- "rustup target add --toolchain $(cat execution-engine/rust-toolchain) wasm32-unknown-unknown"
- "make docker-build/explorer"
- "make docker-build/grpcwebproxy"
environment:
_JAVA_OPTIONS: "-Xms2G -Xmx2G -XX:MaxMetaspaceSize=1G"
image: "casperlabs/buildenv:latest"
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
when:
branch:
- staging
- trying
depends_on:
- rust-compile-test-bors
- sbt-test-docker-bors
- name: docker-keys-gen-test-bors
commands:
- "mkdir /tmp/keys-DRONE-${DRONE_BUILD_NUMBER}"
- "./hack/key-management/docker-gen-keys.sh /tmp/keys-DRONE-${DRONE_BUILD_NUMBER} --test"
- "rm -rf /tmp/keys-DRONE-${DRONE_BUILD_NUMBER}"
image: "casperlabs/buildenv:latest"
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
- name: temp
path: "/tmp"
when:
branch:
- staging
- trying
changeset:
includes:
- "**/.drone.yml"
- "hack/key-management/**"
depends_on:
- docker-build-key-bors
# The below section is for post-bors push webhooks
- name: rust-compile-for-make
commands:
- "cd execution-engine"
- "make setup-rs"
- "make build"
image: "casperlabs/buildenv:latest"
when:
branch:
- dev
- release-*
- master
event:
- push
- name: docker-build-ee-merge
commands:
- "export DOCKER_LATEST_TAG=DRONE-${DRONE_BUILD_NUMBER}"
- "make setup-rs -C ./execution-engine"
- "make docker-build/execution-engine"
environment:
_JAVA_OPTIONS: "-Xms2G -Xmx2G -XX:MaxMetaspaceSize=1G"
image: "casperlabs/buildenv:latest"
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
when:
branch:
- dev
- release-*
- master
event:
- push
depends_on:
- rust-compile-for-make
- name: docker-key-gen-merge
commands:
- "export DOCKER_LATEST_TAG=DRONE-${DRONE_BUILD_NUMBER}"
- "make docker-build/key-generator"
image: "casperlabs/buildenv:latest"
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
when:
branch:
- dev
- release-*
- master
event:
- push
- name: docker-explorer-merge
commands:
- "export DOCKER_LATEST_TAG=DRONE-${DRONE_BUILD_NUMBER}"
- "make docker-build/explorer"
image: "casperlabs/buildenv:latest"
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
when:
branch:
- dev
- release-*
- master
event:
- push
- name: docker-grpcwebproxy-merge
commands:
- "export DOCKER_LATEST_TAG=DRONE-${DRONE_BUILD_NUMBER}"
- "make docker-build/grpcwebproxy"
image: "casperlabs/buildenv:latest"
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
when:
branch:
- dev
- release-*
- master
event:
- push
- name: make-clean-before-package
commands:
- "make clean"
environment:
_JAVA_OPTIONS: "-Xms2G -Xmx2G -XX:MaxMetaspaceSize=1G"
image: "casperlabs/buildenv:latest"
when:
branch:
- dev
- release-*
- master
event:
- push
depends_on:
- rust-compile-for-make
- docker-build-ee-merge
- docker-key-gen-merge
- docker-explorer-merge
- docker-grpcwebproxy-merge
- name: package-sbt-artifacts-merge
commands:
- "make build-client-contracts build-node-contracts"
- "rm -rf project/target project/project/target"
- "sbt update test node/debian:packageBin node/universal:packageZipTarball node/rpm:packageBin"
- "export DOCKER_LATEST_TAG=DRONE-${DRONE_BUILD_NUMBER}"
- "make docker-build/node"
- "mkdir -p artifacts/${DRONE_BRANCH}"
- "cp node/target/casperlabs-node_*_all.deb node/target/universal/*.tgz artifacts/${DRONE_BRANCH}"
- "cp node/target/rpm/RPMS/noarch/casperlabs-node-*.noarch.rpm artifacts/${DRONE_BRANCH}"
environment:
_JAVA_OPTIONS: "-Xms2G -Xmx2G -XX:MaxMetaspaceSize=1G"
image: "casperlabs/buildenv:latest"
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
when:
branch:
- dev
- release-*
- master
event:
- push
depends_on:
- make-clean-before-package
- name: package-ee
commands:
- "mkdir -p artifacts/${DRONE_BRANCH}"
- "make setup -C ./execution-engine"
- "make cargo-package-all"
- "cp execution-engine/target/system-contracts.tar.gz artifacts/${DRONE_BRANCH}"
- "cp execution-engine/target/debian/casperlabs-engine-grpc-server_*.deb artifacts/${DRONE_BRANCH}"
- "cp execution-engine/target/release/rpmbuild/RPMS/x86_64/casperlabs-engine-grpc-server-*.rpm artifacts/${DRONE_BRANCH}"
- "WORKING_DIR=$(pwd) ; cd execution-engine/target/release/rpmbuild/SOURCES ; OS=$(uname -s | tr '[:upper:]' '[:lower:]') ; ARCH=$(uname -p) ; SOURCE=$(ls casperlabs-engine-grpc-server-*.tar.gz | sed \"s/.tar.gz//\") ; TARGET=$(ls $SOURCE*.tar.gz | sed \"s/.tar.gz/_\"$OS\"_\"$ARCH\".tar.gz/\") ; tar -xzf $SOURCE.tar.gz ; tar -czf $TARGET -C $SOURCE/usr/bin/ . && cp $TARGET $WORKING_DIR/artifacts/${DRONE_BRANCH}"
image: "casperlabs/buildenv:latest"
when:
branch:
- dev
- release-*
- master
event:
- push
depends_on:
- package-sbt-artifacts-merge
- name: rsync-artifacts
image: drillster/drone-rsync
settings:
delete: true
hosts:
- $REPO_HOST
recursive: true
source: "artifacts/${DRONE_BRANCH}"
target: $REPO_PATH/
environment:
REPO_HOST:
from_secret: repo_host
REPO_PATH:
from_secret: repo_path
RSYNC_KEY:
from_secret: rsync_key
RSYNC_USER:
from_secret: rsync_user
when:
branch:
- dev
- release-*
- master
event:
- push
depends_on:
- package-sbt-artifacts-merge
- package-ee
- name: docker-publish
commands:
- |
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
if [ ! -z ${DRONE_TAG} ]; then
REF=${DRONE_TAG}
else
REF=${DRONE_BRANCH}
fi
docker tag casperlabs/node:DRONE-${DRONE_BUILD_NUMBER} casperlabs/node:"$REF"
docker tag casperlabs/execution-engine:DRONE-${DRONE_BUILD_NUMBER} casperlabs/execution-engine:"$REF"
docker tag casperlabs/key-generator:DRONE-${DRONE_BUILD_NUMBER} casperlabs/key-generator:"$REF"
docker tag casperlabs/explorer:DRONE-${DRONE_BUILD_NUMBER} casperlabs/explorer:"$REF"
docker tag casperlabs/grpcwebproxy:DRONE-${DRONE_BUILD_NUMBER} casperlabs/grpcwebproxy:"$REF"
docker push casperlabs/node:"$REF"
docker push casperlabs/execution-engine:"$REF"
docker push casperlabs/key-generator:"$REF"
docker push casperlabs/explorer:"$REF"
docker push casperlabs/grpcwebproxy:"$REF"
if [ "${DRONE_BRANCH}" = "master" ]; then
docker tag casperlabs/node:DRONE-${DRONE_BUILD_NUMBER} casperlabs/node:latest
docker tag casperlabs/execution-engine:DRONE-${DRONE_BUILD_NUMBER} casperlabs/execution-engine:latest
docker tag casperlabs/key-generator:DRONE-${DRONE_BUILD_NUMBER} casperlabs/key-generator:latest
docker tag casperlabs/explorer:DRONE-${DRONE_BUILD_NUMBER} casperlabs/explorer:latest
docker tag casperlabs/grpcwebproxy:DRONE-${DRONE_BUILD_NUMBER} casperlabs/grpcwebproxy:latest
docker push casperlabs/node:latest
docker push casperlabs/execution-engine:latest
docker push casperlabs/key-generator:latest
docker push casperlabs/explorer:latest
docker push casperlabs/grpcwebproxy:latest
fi
echo "done"
image: "casperlabs/buildenv:latest"
environment:
DOCKER_PASSWORD:
from_secret: docker_password
DOCKER_USERNAME:
from_secret: docker_username
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
when:
branch:
- dev
- release-*
- master
event:
- push
depends_on:
- docker-build-ee-merge
- docker-key-gen-merge
- docker-explorer-merge
- docker-grpcwebproxy-merge
- package-sbt-artifacts-merge
volumes:
- name: docker_sock
host:
path: "/var/run/docker.sock"
- name: temp
host:
path: "/tmp"
trigger:
branch:
- dev
- master
- "release-*"
- "testing*"
- trying
- staging
- "feature-*"
---
kind: pipeline
name: cleanup
clone:
disable: true
steps:
- name: cleanup-docker-images
commands:
- "docker images --filter \"dangling=true\" -q --no-trunc | xargs --no-run-if-empty docker rmi -f || true"
- "docker images | grep \"DRONE-${DRONE_BUILD_NUMBER}\" | awk '{print $3}' | xargs --no-run-if-empty docker rmi -f || true"
- "docker images | grep DRONE | grep -E '([1-9][0-9]|[4-9]).hours' | awk '{print $3}' | sort -n | uniq | xargs --no-run-if-empty docker rmi -f || true"
environment:
_JAVA_OPTIONS: "-Xms2G -Xmx2G -XX:MaxMetaspaceSize=1G"
image: "casperlabs/buildenv:latest"
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
volumes:
- name: docker_sock
host:
path: "/var/run/docker.sock"
trigger:
status:
- failure
- success
branch:
- dev
- master
- "release-*"
- "testing*"
- trying
- staging
- "feature-*"
depends_on:
- build-bors-merge
---
kind: pipeline
name: rebuild-buildenv
clone:
disable: true
steps:
- name: update-buildenv
image: plugins/downstream
settings:
repositories:
- "CasperLabs/buildenv@master"
environment:
DOWNSTREAM_SERVER:
from_secret: downstream_server
DOWNSTREAM_TOKEN:
from_secret: downstream_token
trigger:
status:
- success
branch:
- dev
event:
- push
depends_on:
- build-bors-merge
---
kind: pipeline
name: failed-build-alert
clone:
disable: true
steps:
- name: notify
image: plugins/slack
settings:
webhook:
from_secret: slack_webhook
template:
- |
*{{ uppercasefirst build.status }}*
Author: {{ build.author }}
Drone Build: <{{ build.link }}|#{{ build.number }}>
Commit Link: <https://github.com/{{repo.owner}}/{{repo.name}}/commit/{{build.commit}}|{{ truncate build.commit 10 }}>
trigger:
status:
- failure
branch:
- dev
- master
- "release-*"
- "testing*"
- trying
- staging
- "feature-*"
depends_on:
- build-bors-merge
---
kind: pipeline
name: on-tag
# Run only on tagged release version
steps:
- name: package-sbt-artifacts-tag
commands:
- "make build-client-contracts build-node-contracts"
- "sbt update test node/debian:packageBin node/universal:packageZipTarball node/rpm:packageBin"
- "mkdir -p artifacts/${DRONE_BRANCH}"
- "cp node/target/casperlabs-node_*_all.deb node/target/universal/*.tgz artifacts/${DRONE_BRANCH}"
- "cp node/target/rpm/RPMS/noarch/casperlabs-node-*.noarch.rpm artifacts/${DRONE_BRANCH}"
environment:
_JAVA_OPTIONS: "-Xms2G -Xmx2G -XX:MaxMetaspaceSize=1G"
image: "casperlabs/buildenv:latest"
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
when:
ref:
- refs/tags/v*
- name: package-ee-tag
commands:
- "mkdir -p artifacts/${DRONE_BRANCH}"
- "make setup -C ./execution-engine"
- "make cargo-package-all"
- "cp execution-engine/target/system-contracts.tar.gz artifacts/${DRONE_BRANCH}"
- "cp execution-engine/target/debian/casperlabs-engine-grpc-server_*.deb artifacts/${DRONE_BRANCH}"
- "cp execution-engine/target/release/rpmbuild/RPMS/x86_64/casperlabs-engine-grpc-server-*.rpm artifacts/${DRONE_BRANCH}"
- "WORKING_DIR=$(pwd) ; cd execution-engine/target/release/rpmbuild/SOURCES ; OS=$(uname -s | tr '[:upper:]' '[:lower:]') ; ARCH=$(uname -p) ; SOURCE=$(ls casperlabs-engine-grpc-server-*.tar.gz | sed \"s/.tar.gz//\") ; TARGET=$(ls $SOURCE*.tar.gz | sed \"s/.tar.gz/_\"$OS\"_\"$ARCH\".tar.gz/\") ; tar -xzf $SOURCE.tar.gz ; tar -czf $TARGET -C $SOURCE/usr/bin/ . && cp $TARGET $WORKING_DIR/artifacts/${DRONE_BRANCH}"
image: "casperlabs/buildenv:latest"
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
when:
ref:
- refs/tags/v*
depends_on:
- package-sbt-artifacts-tag
- name: build-docker-tag
image: "casperlabs/buildenv:latest"
commands:
- "export DOCKER_LATEST_TAG=${DRONE_TAG}"
- "make docker-build/node"
- "make docker-build/execution-engine"
- "make docker-build/key-generator"
- "make docker-build/explorer"
- "make docker-build/grpcwebproxy"
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
when:
ref:
- refs/tags/v*
depends_on:
- package-ee-tag
- name: publish-docker-tag
image: "casperlabs/buildenv:latest"
failure: "ignore"
environment:
DOCKER_PASSWORD:
from_secret: docker_password
DOCKER_USERNAME:
from_secret: docker_username
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
commands:
- |
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
docker push casperlabs/node:"${DRONE_TAG}"
docker push casperlabs/execution-engine:"${DRONE_TAG}"
docker push casperlabs/key-generator:"${DRONE_TAG}"
docker push casperlabs/explorer:"${DRONE_TAG}"
docker push casperlabs/grpcwebproxy:"${DRONE_TAG}"
when:
ref:
- refs/tags/v*
depends_on:
- build-docker-tag
- name: generate-metapackages
commands:
- "mkdir -p artifacts/${DRONE_BRANCH}"
- "WORKING_DIR=$(pwd)/artifacts/${DRONE_BRANCH}/"
- "cd $WORKING_DIR"
- "THIS_VERSION=$(ls casperlabs-engine-grpc-server_*_amd64.deb | sed 's/casperlabs-engine-grpc-server_//' | sed 's/_amd64.deb//')"
- "THIS_VERSION_MAJOR=$(echo $THIS_VERSION | cut -d '.' -f 1)"
- "THIS_VERSION_MINOR=$(echo $THIS_VERSION | cut -d '.' -f 2,3)"
- "cd /opt/bintray/artifacts"
- "echo $THIS_VERSION"
- "echo $THIS_VERSION_MINOR"
- "echo $THIS_VERSION_MAJOR"
- "sed -i 's/THIS_VERSION_MAJOR/'$THIS_VERSION_MAJOR'/g' rpmbuild/SPECS/casperlabs-all.spec"
- "sed -i 's/THIS_VERSION_MINOR/'$THIS_VERSION_MINOR'/g' rpmbuild/SPECS/casperlabs-all.spec"
- "sed -i 's/THIS_VERSION/'$THIS_VERSION'/g' rpmbuild/SPECS/casperlabs-all.spec"
- "rpmbuild -bb rpmbuild/SPECS/casperlabs-all.spec -D '_topdir '$(pwd)'/rpmbuild' -D 'SRC '$(pwd)"
- "sed -i 's/THIS_VERSION/'$THIS_VERSION'/g' /opt/bintray/artifacts/deb_build/casperlabs-all.cfg"
- "equivs-build deb_build/casperlabs-all.cfg"
- "cp /opt/bintray/artifacts/casperlabs_*_all.deb $WORKING_DIR/"
- "cp /opt/bintray/artifacts/rpmbuild/RPMS/x86_64/casperlabs-*.rpm $WORKING_DIR/"
image: "casperlabs/buildenv:latest"
volumes:
- name: docker_sock
path: "/var/run/docker.sock"
when:
ref:
- refs/tags/v*
depends_on:
- package-ee-tag
- name: github_publish_release_artifacts
settings:
api_key:
from_secret: github_token
checksum:
- sha256
- md5
files:
- "artifacts/${DRONE_BRANCH}/*"
prerelease:
- true
image: plugins/github-release
when:
ref:
- refs/tags/v*
depends_on:
- generate-metapackages
- name: bintray-publish
image: "casperlabs/buildenv:latest"
failure: "ignore"
script: |
set -ex
API_URL="https://api.bintray.com"
UPLOAD_DIR=$(pwd)/artifacts/${DRONE_BRANCH}
cd $UPLOAD_DIR
echo "Uploading file to bintray:${DRONE_TAG} ..."
echo -e "\nDEBIAN" && find . -maxdepth 1 -type f -iregex ".*\\.deb" -printf "%f\n" | xargs -I {} sh -c "echo Attempting to upload [{}] && curl -T {} -u$BINTRAY_USER:$BINTRAY_API_KEY $API_URL/content/casperlabs/debian/CasperLabs/${DRONE_TAG}/{} && echo"
echo -e "\nRPMS" && find . -maxdepth 1 -type f -iregex ".*\\.rpm" -printf "%f\n" | xargs -I {} sh -c "echo Attempting to upload [{}] && curl -T {} -u$BINTRAY_USER:$BINTRAY_API_KEY $API_URL/content/casperlabs/rpm/CasperLabs/${DRONE_TAG}/{} && echo"
# sleep 10 && echo -e "\nPublishing CL Packages on bintray..."
# curl -X POST -u$BINTRAY_USER:$BINTRAY_API_KEY $API_URL/content/casperlabs/debian/CasperLabs/${DRONE_TAG}/publish
# curl -X POST -u$BINTRAY_USER:$BINTRAY_API_KEY $API_URL/content/casperlabs/rpm/CasperLabs/${DRONE_TAG}/publish
# sleep 10 && echo -e "\nGPG Signing CL Packages on bintray..."
# curl -X POST -u$BINTRAY_USER:$BINTRAY_API_KEY -H "Content-Type: application/json" --data '{"private_key": "'$BINTRAY_PK'", "passphrase": "'$BINTRAY_GPG_PASSPHRASE'"}' $API_URL/gpg/casperlabs/debian/CasperLabs/versions/${DRONE_TAG}