forked from paritytech/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
1074 lines (946 loc) · 33.9 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
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
# .gitlab-ci.yml
# paritytech/scripts
#
stages:
- build
- test
- prod
- publish-docker-description
variables: &default-vars
REGISTRY_PATH: docker.io/paritytech
REGISTRY_NAME: docker.io
CI_IMAGE: quay.io/buildah/stable:v1.27
default:
cache: {}
interruptible: true
retry:
max: 2
when:
- runner_system_failure
- unknown_failure
- api_failure
.build: &docker_build
stage: build
image: $CI_IMAGE
rules:
- if: $IMAGE_NAME == $CI_JOB_NAME
tags:
- kubernetes-parity-build
# Push to Dockerhub using buildah
.push_to_docker_hub: &push_to_docker_hub
- export IMAGE_DATE_TAG="$CI_COMMIT_SHORT_SHA-$(date +%Y%m%d)"
- buildah version
- buildah bud
--format=docker
--build-arg VCS_REF="$CI_COMMIT_SHA"
--build-arg BUILD_DATE="$(date +%Y%m%d)"
--build-arg REGISTRY_PATH="$REGISTRY_PATH"
--tag "$REGISTRY_PATH/$IMAGE_NAME:$IMAGE_DATE_TAG"
--tag "$REGISTRY_PATH/$IMAGE_NAME:latest"
--file "dockerfiles/$IMAGE_NAME/Dockerfile" dockerfiles
- buildah info
- echo "$Docker_Hub_Pass_Parity" |
buildah login --username "$Docker_Hub_User_Parity" --password-stdin "$REGISTRY_NAME"
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:$IMAGE_DATE_TAG"
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:latest"
- buildah logout "$REGISTRY_NAME"
.push_to_staging: &push_to_staging
- buildah bud
--format=docker
--build-arg VCS_REF="$CI_COMMIT_SHA"
--build-arg BUILD_DATE="$(date +%Y%m%d)"
--build-arg REGISTRY_PATH="$REGISTRY_PATH"
--tag "$REGISTRY_PATH/$IMAGE_NAME:staging"
--file "dockerfiles/$IMAGE_NAME/Dockerfile" dockerfiles
- echo "$Docker_Hub_Pass_Parity" |
buildah login --username "$Docker_Hub_User_Parity" --password-stdin "$REGISTRY_NAME"
- buildah info
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:staging"
- buildah logout "$REGISTRY_NAME"
.publish_as_latest_too: &publish_as_latest_too
- echo "$Docker_Hub_Pass_Parity" |
buildah login --username "$Docker_Hub_User_Parity" --password-stdin "$REGISTRY_NAME"
- buildah info
- buildah tag "$REGISTRY_PATH/$IMAGE_NAME:staging" "$REGISTRY_PATH/$IMAGE_NAME:latest"
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:latest"
- buildah logout "$REGISTRY_NAME"
.push_to_production: &push_to_production
- export IMAGE_DATE_TAG="$CI_COMMIT_SHORT_SHA-$(date +%Y%m%d)"
- env REGISTRY_AUTH_FILE= buildah pull "$REGISTRY_PATH/$IMAGE_NAME:staging"
- buildah tag "$REGISTRY_PATH/$IMAGE_NAME:staging" "$REGISTRY_PATH/$IMAGE_NAME:production"
- buildah tag "$REGISTRY_PATH/$IMAGE_NAME:staging" "$REGISTRY_PATH/$IMAGE_NAME:$IMAGE_DATE_TAG"
- echo "$Docker_Hub_Pass_Parity" |
buildah login --username "$Docker_Hub_User_Parity" --password-stdin "$REGISTRY_NAME"
- buildah info
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:production"
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:$IMAGE_DATE_TAG"
- buildah logout "$REGISTRY_NAME"
.docker_build_only: &docker_build_only
- buildah bud
--format=docker
--build-arg VCS_REF="$CI_COMMIT_SHA"
--build-arg BUILD_DATE="$(date +%Y%m%d)"
--build-arg REGISTRY_PATH="$REGISTRY_PATH"
--tag "$REGISTRY_PATH/$IMAGE_NAME:staging"
--file "dockerfiles/$IMAGE_NAME/Dockerfile" dockerfiles
.publish-docker-image-description:
stage: publish-docker-description
image: paritytech/dockerhub-description
variables:
DOCKERHUB_REPOSITORY: paritytech/$IMAGE_NAME
DOCKER_USERNAME: $Docker_Hub_User_Parity
DOCKER_PASSWORD: $Docker_Hub_Pass_Parity
README_FILEPATH: $CI_PROJECT_DIR/dockerfiles/$IMAGE_NAME/README.md
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_COMMIT_REF_NAME == "master"
changes:
- dockerfiles/$IMAGE_NAME/README.md
script:
- cd / && sh entrypoint.sh
tags:
- kubernetes-parity-build
#### stage: build
# Only build in PR
.docker_build_pr: &docker_build_pr
stage: build
image: $CI_IMAGE
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
changes:
- dockerfiles/${IMAGE_NAME}/**
script:
- *docker_build_only
tags:
- kubernetes-parity-build
ansible-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "ansible"
awscli-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "awscli"
base-ci-linux-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "base-ci-linux"
benchmarks-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "benchmarks"
bridges-ci-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "bridges-ci"
polkadotjs-cli-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "polkadotjs-cli"
ci-linux-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "ci-linux"
contracts-ci-linux-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "contracts-ci-linux"
ink-ci-linux-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "ink-ci-linux"
ink-waterfall-ci-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "ink-waterfall-ci"
lz4-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "lz4"
mdbook-utils-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "mdbook-utils"
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
changes:
- dockerfiles/mdbook-utils/**
mitogen-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "mitogen"
molecule-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "molecule"
multisig-ci-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "multisig-ci"
node-bench-regression-guard-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "node-bench-regression-guard"
node-wrk-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "node-wrk"
parity-keyring-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "parity-keyring"
parity-scale-codec-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "parity-scale-codec"
query-exporter-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "query-exporter"
redis-exporter-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "redis-exporter"
rpm-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "rpm"
rusty-cachier-env-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "rusty-cachier-env"
sops-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "sops"
substrate-session-keys-grabber-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "substrate-session-keys-grabber"
terraform-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "terraform"
tools-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "tools"
ws-health-exporter-pr:
<<: *docker_build_pr
variables:
IMAGE_NAME: "ws-health-exporter"
xbuilder-aarch64-unknown-linux-gnu:
<<: *docker_build_pr
variables:
IMAGE_NAME: "xbuilder-aarch64-unknown-linux-gnu"
# releng-scripts needs custom config because files are in a separate repo
releng-scripts-download-pr:
stage: build
image: "paritytech/ci-linux:production"
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
when: on_success
expire_in: 3 hours
paths:
- ./artifacts/
variables:
GIT_FETCH: 0
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
changes:
- dockerfiles/releng-scripts/**
script:
- mkdir -p artifacts/
- cd artifacts/
- git clone https://github.com/paritytech/releng-scripts
tags:
- kubernetes-parity-build
releng-scripts-pr:
<<: *docker_build_pr
needs:
- job: releng-scripts-download-pr
artifacts: true
variables:
IMAGE_NAME: "releng-scripts"
script:
- mv dockerfiles/$IMAGE_NAME/Dockerfile artifacts/releng-scripts/
- cd artifacts/releng-scripts/
- buildah bud
--format=docker
--build-arg VCS_REF="$CI_COMMIT_SHA"
--build-arg BUILD_DATE="$(date +%Y%m%d)"
--build-arg REGISTRY_PATH="$REGISTRY_PATH"
--tag "$REGISTRY_PATH/$IMAGE_NAME:staging"
--file "Dockerfile"
# Build and push to docker hub
ansible:
<<: *docker_build
script:
- *push_to_docker_hub
base-ci-linux:
<<: *docker_build
script:
- *push_to_docker_hub
ci-linux:
<<: *docker_build
script:
- *push_to_staging
ink-ci-linux:
<<: *docker_build
script:
- *push_to_staging
parity-scale-codec:
<<: *docker_build
script:
- *push_to_staging
ink-waterfall-ci:
<<: *docker_build
script:
- *push_to_docker_hub
contracts-ci-linux:
<<: *docker_build
script:
- *push_to_docker_hub
debian10:
<<: *docker_build
script:
- *push_to_docker_hub
bridges-ci:
<<: *docker_build
script:
- *push_to_staging
polkadotjs-cli:
<<: *docker_build
script:
- *push_to_docker_hub
awscli:
<<: *docker_build
script:
- *push_to_docker_hub
tools:
<<: *docker_build
script:
- *push_to_docker_hub
benchmarks:
<<: *docker_build
script:
- *push_to_docker_hub
query-exporter:
<<: *docker_build
script:
- *push_to_docker_hub
redis-exporter:
<<: *docker_build
script:
- *push_to_docker_hub
rusty-cachier-env:
<<: *docker_build
script:
- *push_to_docker_hub
mdbook-utils:
<<: *docker_build
script:
- *push_to_docker_hub
mitogen:
<<: *docker_build
script:
- *push_to_docker_hub
molecule:
<<: *docker_build
script:
- *push_to_docker_hub
multisig-ci:
<<: *docker_build
script:
- *push_to_docker_hub
node-bench-regression-guard:
<<: *docker_build
script:
- *push_to_docker_hub
node-wrk:
<<: *docker_build
script:
- *push_to_docker_hub
gnupg:
<<: *docker_build
script:
- *push_to_docker_hub
parity-keyring:
<<: *docker_build
script:
- *push_to_docker_hub
rpm:
<<: *docker_build
script:
- *push_to_docker_hub
deb:
<<: *docker_build
script:
- *push_to_docker_hub
lz4:
<<: *docker_build
script:
- *push_to_docker_hub
ws-health-exporter:
<<: *docker_build
script:
- *push_to_docker_hub
xbuilder-aarch64-unknown-linux-gnu:
<<: *docker_build
script:
- *push_to_docker_hub
# special case as version tags are introduced
kubetools:
<<: *docker_build
variables:
<<: *default-vars
# https://github.com/kubernetes/kubernetes/releases
BUILD_KUBE_VERSION: "1.18.2"
# https://github.com/kubernetes/helm/releases
# will be overwritten by the global variable at
# https://gitlab.parity.io/groups/parity/-/settings/ci_cd
BUILD_HELM_VERSION: "2.16.11"
script:
- |
cat <<-EOT
|
| # build of kubetools image
|
| KUBE_VERSION = $BUILD_KUBE_VERSION
| HELM_VERSION = $BUILD_HELM_VERSION
|
EOT
# beware that latest is helm2, not helm3
# TODO: helm3 should be latest
- buildah bud
--format=docker
--build-arg VCS_REF="$CI_COMMIT_SHA"
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
--build-arg REGISTRY_PATH="$REGISTRY_PATH"
--build-arg KUBE_VERSION="$BUILD_KUBE_VERSION"
--build-arg HELM_VERSION="$BUILD_HELM_VERSION"
--tag "$REGISTRY_PATH/$IMAGE_NAME:latest"
--tag "$REGISTRY_PATH/$IMAGE_NAME:helm2"
--tag "$REGISTRY_PATH/$IMAGE_NAME:$BUILD_HELM_VERSION"
--file "dockerfiles/$IMAGE_NAME/helm/Dockerfile" dockerfiles
# Push to Dockerhub
- echo "$Docker_Hub_Pass_Parity" |
buildah login --username "$Docker_Hub_User_Parity" --password-stdin "$REGISTRY_NAME"
- buildah info
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:latest"
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:helm2"
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:$BUILD_HELM_VERSION"
- buildah logout "$REGISTRY_NAME"
# waits until kubetools job above is deprecated, "latest" tag remains after the old image
kubetools-helm:
<<: *docker_build
variables:
<<: *default-vars
# https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/
KUBE_VERSION: "1.24.3"
# https://github.com/helm/helm/releases
HELM_VERSION: "3.9.2"
# https://github.com/roboll/helmfile/releases
HELMFILE_VERSION: "0.144.0"
# https://github.com/databus23/helm-diff/releases
HELM_DIFF_PLUGIN_VERSION: "3.5.0"
# https://github.com/jkroepke/helm-secrets
HELM_SECRETS_VERSION: "3.14.0"
# https://github.com/variantdev/vals/releases
VALS_VERSION: "0.18.0"
# https://releases.hashicorp.com/vault/
VAULT_VERSION: "1.11.2"
# https://github.com/kubernetes-sigs/kustomize/releases
KUSTOMIZE_VERSION: "4.5.7"
script:
- |
cat <<-EOT
|
| # build of kubetools image
|
|
| HELM_VERSION = $HELM_VERSION
| HELMFILE_VERSION = $HELMFILE_VERSION
| HELM_DIFF_PLUGIN_VERSION = $HELM_DIFF_PLUGIN_VERSION
| HELM_SECRETS_VERSION = $HELM_SECRETS_VERSION
| KUBE_VERSION = $KUBE_VERSION
| VALS_VERSION = $VALS_VERSION
| VAULT_VERSION = $VAULT_VERSION
| KUSTOMIZE_VERSION = $KUSTOMIZE_VERSION
|
EOT
- buildah bud
--format=docker
--build-arg VCS_REF="$CI_COMMIT_SHA"
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
--build-arg REGISTRY_PATH="$REGISTRY_PATH"
--build-arg KUBE_VERSION="$KUBE_VERSION"
--build-arg HELM_VERSION="$HELM_VERSION"
--build-arg HELMFILE_VERSION="$HELMFILE_VERSION"
--build-arg HELM_DIFF_PLUGIN_VERSION="$HELM_DIFF_PLUGIN_VERSION"
--build-arg HELM_SECRETS_VERSION="$HELM_SECRETS_VERSION"
--build-arg VALS_VERSION="$VALS_VERSION"
--build-arg VAULT_VERSION="$VAULT_VERSION"
--build-arg KUSTOMIZE_VERSION="$KUSTOMIZE_VERSION"
--tag "$REGISTRY_PATH/kubetools:helm3"
--tag "$REGISTRY_PATH/kubetools:$HELM_VERSION"
--tag "$REGISTRY_PATH/$IMAGE_NAME:latest"
--tag "$REGISTRY_PATH/$IMAGE_NAME:$HELM_VERSION"
--file "dockerfiles/kubetools/helm/helm3.Dockerfile" dockerfiles
# Push to Dockerhub
- echo "$Docker_Hub_Pass_Parity" |
buildah login --username "$Docker_Hub_User_Parity" --password-stdin "$REGISTRY_NAME"
- buildah info
- buildah push --format=v2s2 "$REGISTRY_PATH/kubetools:helm3"
- buildah push --format=v2s2 "$REGISTRY_PATH/kubetools:$HELM_VERSION"
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:latest"
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:$HELM_VERSION"
- buildah logout "$REGISTRY_NAME"
kubetools-kubectl:
<<: *docker_build
variables:
<<: *default-vars
KUBE_VERSION: "1.24.7"
script:
- buildah bud
--format=docker
--build-arg VCS_REF="$CI_COMMIT_SHA"
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
--build-arg REGISTRY_PATH="$REGISTRY_PATH"
--build-arg KUBE_VERSION="$KUBE_VERSION"
--tag "$REGISTRY_PATH/$IMAGE_NAME:latest"
--tag "$REGISTRY_PATH/$IMAGE_NAME:$KUBE_VERSION"
--file "dockerfiles/kubetools/kubectl/Dockerfile" dockerfiles
# Push to Dockerhub
- echo "$Docker_Hub_Pass_Parity" |
buildah login --username "$Docker_Hub_User_Parity" --password-stdin "$REGISTRY_NAME"
- buildah info
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:latest"
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:$KUBE_VERSION"
- buildah logout "$REGISTRY_NAME"
terraform:
<<: *docker_build
variables:
<<: *default-vars
# https://releases.hashicorp.com/terraform/
TERRAFORM_VERSION: "1.3.8"
# https://releases.hashicorp.com/vault/
VAULT_VERSION: "1.8.12"
script:
- |
cat <<-EOT
|
| # build of terraform image
|
| TERRAFORM_VERSION = $TERRAFORM_VERSION
| VAULT_VERSION = $VAULT_VERSION
|
EOT
- buildah bud
--format=docker
--build-arg VCS_REF="$CI_COMMIT_SHA"
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
--build-arg REGISTRY_PATH="$REGISTRY_PATH"
--build-arg TERRAFORM_VERSION="$TERRAFORM_VERSION"
--build-arg VAULT_VERSION="$VAULT_VERSION"
--tag "$REGISTRY_PATH/$IMAGE_NAME:latest"
--tag "$REGISTRY_PATH/$IMAGE_NAME:$TERRAFORM_VERSION"
--file "dockerfiles/$IMAGE_NAME/Dockerfile" dockerfiles
# Push to Dockerhub
- echo "$Docker_Hub_Pass_Parity" |
buildah login --username "$Docker_Hub_User_Parity" --password-stdin "$REGISTRY_NAME"
- buildah info
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:latest"
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:$TERRAFORM_VERSION"
- buildah logout "$REGISTRY_NAME"
sops:
<<: *docker_build
variables:
<<: *default-vars
# https://github.com/mozilla/sops/releases/
SOPS_VERSION: "3.7.3"
# https://releases.hashicorp.com/vault/
VAULT_VERSION: "1.11.2"
script:
- |
cat <<-EOT
|
| # build of terraform image
|
| SOPS_VERSION = $SOPS_VERSION
| VAULT_VERSION = $VAULT_VERSION
|
EOT
- buildah bud
--format=docker
--build-arg VCS_REF="$CI_COMMIT_SHA"
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
--build-arg REGISTRY_PATH="$REGISTRY_PATH"
--build-arg SOPS_VERSION="$SOPS_VERSION"
--build-arg VAULT_VERSION="$VAULT_VERSION"
--tag "$REGISTRY_PATH/$IMAGE_NAME:latest"
--tag "$REGISTRY_PATH/$IMAGE_NAME:$SOPS_VERSION"
--file "dockerfiles/$IMAGE_NAME/Dockerfile" dockerfiles
# Push to Dockerhub
- echo "$Docker_Hub_Pass_Parity" |
buildah login --username "$Docker_Hub_User_Parity" --password-stdin "$REGISTRY_NAME"
- buildah info
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:latest"
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:$SOPS_VERSION"
- buildah logout "$REGISTRY_NAME"
substrate-session-keys-grabber:
<<: *docker_build
script:
- *push_to_docker_hub
# releng-scripts needs custom ci config because files are in a separate repo
releng-scripts-download:
stage: build
image: "paritytech/ci-linux:production"
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
when: on_success
expire_in: 3 hours
paths:
- ./artifacts/
variables:
GIT_FETCH: 0
rules:
- if: $IMAGE_NAME == "releng-scripts"
script:
- mkdir -p artifacts/
- cd artifacts/
- git clone https://github.com/paritytech/releng-scripts
tags:
- kubernetes-parity-build
releng-scripts:
<<: *docker_build
stage: prod
needs:
- job: releng-scripts-download
artifacts: true
script:
- mv dockerfiles/$IMAGE_NAME/Dockerfile artifacts/releng-scripts/
- cd artifacts/releng-scripts/
- export IMAGE_DATE_TAG="$CI_COMMIT_SHORT_SHA-$(date +%Y%m%d)"
- buildah bud
--format=docker
--build-arg VCS_REF="$CI_COMMIT_SHA"
--build-arg BUILD_DATE="$(date +%Y%m%d)"
--build-arg REGISTRY_PATH="$REGISTRY_PATH"
--tag "$REGISTRY_PATH/$IMAGE_NAME:$IMAGE_DATE_TAG"
--tag "$REGISTRY_PATH/$IMAGE_NAME:latest"
--file "Dockerfile"
- buildah info
- echo "$Docker_Hub_Pass_Parity" |
buildah login --username "$Docker_Hub_User_Parity" --password-stdin "$REGISTRY_NAME"
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:$IMAGE_DATE_TAG"
- buildah push --format=v2s2 "$REGISTRY_PATH/$IMAGE_NAME:latest"
- buildah logout "$REGISTRY_NAME"
#### stage: test
container_scanning:
# https://aquasecurity.github.io/trivy/v0.28.0/docs/integrations/gitlab-ci/
image:
name: docker.io/aquasec/trivy:latest
entrypoint: [""]
variables:
GIT_STRATEGY: none
TRIVY_NO_PROGRESS: "true"
TRIVY_CACHE_DIR: ".trivycache/"
FULL_IMAGE_NAME: $REGISTRY_PATH/$IMAGE_NAME:$IMAGE_TAG
script:
- trivy --version
# cache cleanup is needed when scanning images with the same tags, it does not remove the database
- time trivy image --clear-cache
# update vulnerabilities db
- time trivy image --download-db-only
# Builds report and puts it in the default workdir $CI_PROJECT_DIR, so `artifacts:` can take it from there
- time trivy image --exit-code 0 --format template --template "@/contrib/gitlab.tpl"
--output "$CI_PROJECT_DIR/gl-container-scanning-report.json" "$FULL_IMAGE_NAME"
# Prints full report
- time trivy image --exit-code 0 "$FULL_IMAGE_NAME"
# Fail on critical vulnerabilities
- time trivy image --exit-code 1 --severity CRITICAL "$FULL_IMAGE_NAME"
cache:
# TODO: move this cache to k8s volume when it's configured
paths:
- .trivycache/
# Enables https://docs.gitlab.com/ee/user/application_security/container_scanning/
artifacts:
when: always
reports:
container_scanning: gl-container-scanning-report.json
rules:
# $IMAGE_TAG is needed for trivy. Should me mentioned in schedule's variables. I.e. latest, staging, v2.0.0.
- if: $IMAGE_NAME || $IMAGE_TAG
# TODO: remove when all criticals are solved
allow_failure: true
tags:
- kubernetes-parity-build
ci-linux-test-substrate:
stage: test
variables:
CI_IMAGE: "paritytech/ci-linux:staging"
# this is to rewrite "-Dwarnings" we use in Substrate CI since new warnings
# are often introduced and we do not want to fail on them in this case
RUSTFLAGS: "-C debug-assertions"
# disable rusty-cachier completely for this kind of pipelines
RUSTY_CACHIER_SNEAKY_BYPASS: "true"
rules:
- if: $IMAGE_NAME == "ci-linux"
trigger:
project: parity/mirrors/substrate
branch: master
strategy: depend
ci-linux-test-polkadot:
stage: test
variables:
CI_IMAGE: "paritytech/ci-linux:staging"
# this is to rewrite "-Dwarnings" we use in Polkadot CI since new warnings
# are often introduced and we do not want to fail on them in this case
RUSTFLAGS: "-C debug-assertions"
# disable rusty-cachier completely for this kind of pipelines
RUSTY_CACHIER_SNEAKY_BYPASS: "true"
rules:
- if: $IMAGE_NAME == "ci-linux"
trigger:
project: parity/mirrors/polkadot
branch: master
strategy: depend
ink-ci-linux-test:
stage: test
variables:
CI_IMAGE: "paritytech/ink-ci-linux:staging"
rules:
- if: $IMAGE_NAME == "ink-ci-linux"
trigger:
project: parity/mirrors/ink
branch: master
strategy: depend
bridges-ci-test:
stage: test
variables:
CI_IMAGE: "paritytech/bridges-ci:staging"
rules:
- if: $IMAGE_NAME == "bridges-ci"
trigger:
project: parity/mirrors/parity-bridges-common
branch: master
strategy: depend
parity-scale-codec-test:
stage: test
variables:
CI_IMAGE: "paritytech/parity-scale-codec:staging"
rules:
- if: $IMAGE_NAME == "parity-scale-codec"
trigger:
project: parity/mirrors/parity-scale-codec
branch: master
strategy: depend
#### stage: prod
ci-linux-production:
stage: prod
image: $CI_IMAGE
rules:
- if: $IMAGE_NAME == "ci-linux"
script:
- *push_to_production
tags:
- kubernetes-parity-build
ink-ci-linux-production: &push-after-triggered-pipeline
stage: prod
image: $CI_IMAGE
needs:
- job: ink-ci-linux-test
artifacts: false
rules:
- if: $IMAGE_NAME == "ink-ci-linux"
script:
- *push_to_production
tags:
- kubernetes-parity-build
bridges-ci-production:
<<: *push-after-triggered-pipeline
needs:
- job: bridges-ci-test
artifacts: false
rules:
- if: $IMAGE_NAME == "bridges-ci"
parity-scale-codec-production:
<<: *push-after-triggered-pipeline
needs:
- job: parity-scale-codec-test
artifacts: false
rules:
- if: $IMAGE_NAME == "parity-scale-codec"
# Publish images descriptions to hub.docker.com
publish-ansible-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: ansible
SHORT_DESCRIPTION: "ansible utility Docker image."
publish-awscli-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: awscli
SHORT_DESCRIPTION: "awscli utility Docker image."
publish-base-ci-linux-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: base-ci-linux
SHORT_DESCRIPTION: "base-ci-linux utility Docker image."
publish-benchmarks-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: benchmarks
SHORT_DESCRIPTION: "benchmarks utility Docker image."
publish-bridges-ci-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: bridges-ci
SHORT_DESCRIPTION: "bridges-ci utility Docker image."
publish-ci-linux-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: ci-linux
SHORT_DESCRIPTION: "ci-linux utility Docker image."
publish-contracts-ci-linux-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: contracts-ci-linux
SHORT_DESCRIPTION: "contracts-ci-linux utility Docker image."
publish-deb-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: deb
SHORT_DESCRIPTION: "deb utility Docker image."
publish-debian10-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: debian10
SHORT_DESCRIPTION: "debian10 utility Docker image."
publish-gnupg-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: gnupg
SHORT_DESCRIPTION: "gnupg utility Docker image."
publish-ink-ci-linux-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: ink-ci-linux
SHORT_DESCRIPTION: "ink-ci-linux utility Docker image."
publish-ink-waterfall-ci-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: ink-waterfall-ci
SHORT_DESCRIPTION: "ink-waterfall-ci utility Docker image."
publish-kubetools-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: kubetools
SHORT_DESCRIPTION: "kubetools utility Docker image."
publish-lz4-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: lz4
SHORT_DESCRIPTION: "lz4 utility Docker image."
publish-mdbook-utils-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: mdbook-utils
SHORT_DESCRIPTION: "mdbook-utils utility Docker image."
publish-mitogen-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: mitogen
SHORT_DESCRIPTION: "mitogen utility Docker image."
publish-molecule-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: molecule
SHORT_DESCRIPTION: "molecule utility Docker image."
publish-multisig-ci-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: multisig-ci
SHORT_DESCRIPTION: "multisig-ci utility Docker image."
publish-node-bench-regression-guard-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: node-bench-regression-guard
SHORT_DESCRIPTION: "node-bench-regression-guard utility Docker image."
publish-node-wrk-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: node-wrk
SHORT_DESCRIPTION: "node-wrk utility Docker image."
publish-parity-keyring-docker-image-description:
extends: .publish-docker-image-description
variables:
IMAGE_NAME: parity-keyring
SHORT_DESCRIPTION: "parity-keyring utility Docker image."
publish-parity-scale-codec-docker-image-description:
extends: .publish-docker-image-description
variables: