-
Notifications
You must be signed in to change notification settings - Fork 566
/
main.yml
2256 lines (2206 loc) · 80.1 KB
/
main.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
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2.1
aliases:
- &only-release-tags
branches:
ignore: /.*/
tags:
# will ignore nightly
only: /^v\d+\.\d+\.\d+(-(?!nightly)[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/
- &only-nightly-tags
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+-(nightly)+(\.[0-9A-Za-z-]+)*?$/
- &only-alpha-tags
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+-alpha+(\.[0-9A-Za-z-]+)*?$/
orbs:
go: circleci/go@1.7.1
gcp-cli: circleci/gcp-cli@2.4.1
gh: circleci/github-cli@2.1
codecov: codecov/codecov@1.1.0
pulumi: pulumi/pulumi@2.1.0
aws-cli: circleci/aws-cli@3.1.1
node: circleci/node@5.0.2
kubernetes: circleci/kubernetes@1.3.0
aws-eks: circleci/aws-eks@2.2.0
tools: gotest/tools@0.0.14
parameters:
machine_image:
type: string
default: ubuntu-2204:2023.04.2
ci_runner_image:
type: string
default: docker.io/pachyderm/ci-runner:20240205-3f2b2bba3c4cda4e990a413cd27d6cb21862fa5a@sha256:69778c8ae8e2189a6a6539bb70aaea7a2cf4d321f42256ab691daa613b1da10d
go-version:
type: string
default: "1.22.1"
go-releaser-version:
type: string
default: "1.17.1"
kubernetes-version:
type: string
default: "v1.29.2"
run_load_tests:
type: boolean
default: false
run-jupyter-jobs:
type: boolean
default: false
run-core-jobs:
type: boolean
default: false
run-python-sdk-jobs:
type: boolean
default: false
run-label-studio-jobs:
type: boolean
default: false
executors:
docker-go:
docker:
- image: cimg/go:<< pipeline.parameters.go-version >>
python:
docker:
- image: cimg/python:3.10-node
jobs:
static-go-checks:
resource_class: xlarge
machine:
image: << pipeline.parameters.machine_image >>
environment:
GOPROXY: https://proxy.golang.org
TEST_RESULTS: /tmp/test-results
steps:
- checkout
- run:
name: Collect node stats
command: sar 10 -BbdHwzS -I SUM -n DEV -q -r ALL -u ALL -h
background: true
- run:
name: setup env vars
command: |
echo 'export GOCACHE=/home/circleci/.gocache' >> $BASH_ENV
echo 'export GOPATH=/home/circleci/.go_workspace' >> $BASH_ENV
echo 'export PATH=/home/circleci/project/cached-deps:$PATH' >> $BASH_ENV
echo 'export PATH=$GOPATH/bin:$PATH' >> $BASH_ENV
if [[ "$CIRCLE_BRANCH" -eq "" ]] && [[ "$CIRCLE_TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(.*) ]]
then
echo 'export TEST_IMAGE_SHA=$CIRCLE_SHA1' >> $BASH_ENV
else
echo 'export TEST_IMAGE_SHA=cover-$CIRCLE_SHA1' >> $BASH_ENV
fi
- restore_cache:
keys:
- pach-build-dependencies-v2-{{ arch }}-{{ checksum "etc/testing/circle/install.sh" }}
- run: etc/testing/circle/install.sh
- save_cache:
key: pach-build-dependencies-v2-{{ arch }}-{{ checksum "etc/testing/circle/install.sh" }}
paths:
- cached-deps/
- run: mkdir ${TEST_RESULTS}
# The build cache will grow indefinitely, so we rotate the cache once a week.
# This ensures the time to restore the cache isn't longer than the speedup in compilation.
- run: "echo $(($(date +%s)/604800)) > current_week"
- restore_cache:
keys:
- pach-go-build-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "current_week" }}
- pach-go-build-cache-v1-master-{{ arch }}-{{ checksum "current_week" }}
# Only restore the module cache based on an exact match for go.sum.
# This also avoids accumulating old versions of modules over time.
- restore_cache:
keys:
- pach-go-mod-cache-v2-{{ arch }}-{{ checksum "go.sum" }}
- go/install:
version: << pipeline.parameters.go-version >>
- save_cache:
key: pach-go-mod-cache-v2-{{ arch }}-{{ checksum "go.sum" }}
paths:
- /home/circleci/.go_workspace/pkg/mod
- save_cache:
key: pach-go-build-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "current_week" }}
paths:
- /home/circleci/.gocache
- tools/mod-tidy-check
- run:
no_output_timeout: 20m
command: etc/testing/circle/run_ci_linters.sh | ts '%Y-%m-%dT%H:%M:%S'
integration-tests:
resource_class: 2xlarge
parallelism: 9
machine:
image: << pipeline.parameters.machine_image >>
environment:
GOPROXY: https://proxy.golang.org
TEST_RESULTS: /tmp/test-results
steps:
- checkout
- run:
name: Collect node stats
command: sar 10 -BbdHwzS -I SUM -n DEV -q -r ALL -u ALL -h
background: true
- run:
name: setup env vars
command: |
echo 'export GOCACHE=/home/circleci/.gocache' >> $BASH_ENV
echo 'export GOPATH=/home/circleci/.go_workspace' >> $BASH_ENV
echo 'export PATH=/home/circleci/project/cached-deps:$PATH' >> $BASH_ENV
echo 'export PATH=$GOPATH/bin:$PATH' >> $BASH_ENV
echo 'export RUNNER_INDEX="$CIRCLE_NODE_INDEX"' >> $BASH_ENV
if [[ "$CIRCLE_BRANCH" -eq "" ]] && [[ "$CIRCLE_TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(.*) ]]
then
echo 'export TEST_IMAGE_SHA=$CIRCLE_SHA1' >> $BASH_ENV
else
echo 'export TEST_IMAGE_SHA=cover-$CIRCLE_SHA1' >> $BASH_ENV
fi
- restore_cache:
keys:
- pach-build-dependencies-v2-{{ arch }}-{{ checksum "etc/testing/circle/install.sh" }}
- run: etc/testing/circle/install.sh
- install-go-releaser
- save_cache:
key: pach-build-dependencies-v2-{{ arch }}-{{ checksum "etc/testing/circle/install.sh" }}
paths:
- cached-deps/
- run: mkdir ${TEST_RESULTS}
- start-minikube-2xlarge
# The build cache will grow indefinitely, so we rotate the cache once a week.
# This ensures the time to restore the cache isn't longer than the speedup in compilation.
- run: "echo $(($(date +%s)/604800)) > current_week"
- restore_cache:
keys:
- pach-go-build-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "current_week" }}
- pach-go-build-cache-v1-master-{{ arch }}-{{ checksum "current_week" }}
# Only restore the module cache based on an exact match for go.sum.
# This also avoids accumulating old versions of modules over time.
- restore_cache:
keys:
- pach-go-mod-cache-v2-{{ arch }}-{{ checksum "go.sum" }}
- go/install:
version: << pipeline.parameters.go-version >>
- run: go install gotest.tools/gotestsum@latest
- run: CGO_ENABLED=0 GOMAXPROCS=2 go install ./src/server/cmd/pachctl
- run: go mod download
- save_cache:
key: pach-go-mod-cache-v2-{{ arch }}-{{ checksum "go.sum" }}
paths:
- /home/circleci/.go_workspace/pkg/mod
- save_cache:
key: pach-go-build-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "current_week" }}
paths:
- /home/circleci/.gocache
- run:
name: Collect tests to run
command: GOMAXPROCS=2 PACHYDERM_LOG_LEVEL="debug" go run ./src/testing/cmds/harness/test-collector/main.go -tags=k8s -file=tests_to_run_k8s.csv -procs=24
background: true
- wait-for-docker
- run: etc/testing/circle/wait-minikube.sh
- run:
name: Collect kube events
command: kubectl get events -o wide --watch --all-namespaces | ts '%Y-%m-%dT%H:%M:%S'
background: true
- run:
name: Install minio
command: kubectl apply -f etc/testing/minio.yaml
- run:
name: Install prom # Make Launch stats
command: kubectl apply --filename etc/kubernetes-prometheus -R
- run:
name: Wait for docker images to be built
command: etc/testing/circle/wait_for_docker_images.sh
- run:
no_output_timeout: 30m
name: Run Go Integration Tests
command: |-
PROM_PORT=$(kubectl --namespace=monitoring get svc/prometheus -o json | jq -r .spec.ports[0].nodePort)
export PROM_PORT
# enterprise test setup
VM_IP="$(minikube ip)"
export VM_IP
ENTERPRISE_PORT="31650"
export ENTEPRRISE_PORT
echo "{\"pachd_address\": \"grpc://${VM_IP}:${ENTERPRISE_PORT}\", \"source\": 2}" | pachctl config set context "enterprise" --overwrite
pachctl config set active-enterprise-context enterprise
go install -v ./src/testing/match
pachctl config update context "$(pachctl config get active-context)" --pachd-address="$(minikube ip):30650"
# minikube status check
minikube status
kubectl version
# add repo for upgrade tests that use docker images instead of local-built images
helm repo add pachyderm https://helm.pachyderm.com
helm repo update
# any tests that build images will do it directly in minikube's docker registry
eval "$(minikube docker-env)"
GOMEMLIMIT=16000MiB go run src/testing/cmds/harness/test-runner/main.go \
-file=tests_to_run_k8s.csv \
-tags=k8s \
-shard=$CIRCLE_NODE_INDEX \
-total-shards=$CIRCLE_NODE_TOTAL \
-threads=7 \
-gotestsum-args="--format=testdox" \
-gotest-args="-parallel=4 -timeout=30m -cover -test.gocoverdir=\"$TEST_RESULTS\" -covermode=atomic -coverpkg=./..."
- run:
name: Format code coverage
when: always
command: etc/testing/circle/format-coverage.sh
- collect-test-results
- run:
name: Dump debugging info in case of failure
when: on_fail
command: etc/testing/circle/kube_debug.sh
- store_test_results:
path: "/tmp/test-results/circle"
- store_artifacts:
path: /tmp/test-results
- codecov/upload:
file: /tmp/test-results/coverage.txt
helm-tests:
resource_class: large
docker:
- image: << pipeline.parameters.ci_runner_image >>
steps:
- checkout
- run: bazel test --config=remotecache --remote_header=x-buildbuddy-api-key=${BUILDBUDDY_API_KEY} //etc/helm/...
- run:
command: cp -a bazel-testlogs/ /tmp/bazel-testlogs # store_test_results can't handle bazel-testlogs being a symlink
when: always
- store_test_results:
path: /tmp/bazel-testlogs/
helm-build:
docker:
- image: gcr.io/public-builds/chart-releaser:v1.2.1
steps:
- checkout
- run:
name: install yq
command: |
wget https://github.com/mikefarah/yq/releases/download/v4.23.1/yq_linux_amd64
mv yq_linux_amd64 /usr/local/bin/yq
chmod +x /usr/local/bin/yq
- run:
name: install helm
command: |
wget -q https://get.helm.sh/helm-v3.14.2-linux-amd64.tar.gz -O - | tar -xzO linux-amd64/helm > /usr/local/bin/helm && chmod +x /usr/local/bin/helm
- run:
name: make cr release dirs
command: |
mkdir -p cr-release-packages/official
mkdir -p cr-release-packages/local_template
mkdir -p cr-release-packages/preview
- run:
name: package release helm chart
command: |
if [[ "$CIRCLE_TAG" =~ v[0-9]+\.[0-9]+\.[0-9]+-nightly\.[0-9]+ ]]
then
export CONSOLE_VERSION=${CIRCLE_TAG:1}
yq e -i '.console.image.tag=env(CONSOLE_VERSION)' etc/helm/pachyderm/values.yaml
fi
helm package -d cr-release-packages/official --version ${CIRCLE_TAG:1} --app-version ${CIRCLE_TAG:1} etc/helm/pachyderm
- run:
name: generate dd template
command: |
tar -xvzf cr-release-packages/official/pachyderm-${CIRCLE_TAG:1}.tgz
{ helm template pachyderm --set deployTarget=LOCAL --set proxy.enabled=true --set proxy.service.type=LoadBalancer --set pachd.clusterDeploymentID=local-pach --no-hooks --version=${CIRCLE_TAG:1} ; } > cr-release-packages/local_template/pach_local_${CIRCLE_TAG:1}.yaml
- run:
name: mark extra chart pre-release
command: |
yq e -i '.annotations."artifacthub.io/prerelease"="true"' etc/helm/pachyderm/Chart.yaml
- run:
name: package pre-release helm chart
command: |
if [[ "$CIRCLE_TAG" =~ v[0-9]+\.[0-9]+\.[0-9]+-nightly\.[0-9]+ ]]
then
export CONSOLE_VERSION=${CIRCLE_TAG:1}
yq e -i '.console.image.tag=env(CONSOLE_VERSION)' etc/helm/pachyderm/values.yaml
fi
helm package -d cr-release-packages/preview --version ${CIRCLE_TAG:1}-${CIRCLE_SHA1} --app-version ${CIRCLE_TAG:1} etc/helm/pachyderm
- persist_to_workspace:
root: .
paths:
- cr-release-packages/*
helm-publish:
parameters:
preview:
type: boolean
default: false
docker:
- image: gcr.io/public-builds/chart-releaser:v1.2.1
steps:
- attach_workspace:
at: ./
- run:
name: download and install helm
command: |
wget -q https://get.helm.sh/helm-v3.14.2-linux-amd64.tar.gz -O - | tar -xzO linux-amd64/helm > /usr/local/bin/helm && chmod +x /usr/local/bin/helm
# Set CR_Token to GH Personal Access Token (Found in pachydermbuildbot GH Acount)
# The cr index step below will commit back to the repo (via https + GH Token) need to configure git for the commit
- run:
name: set git bot user
command: |
git config --global user.email buildbot@pachyderm.io
- run:
name: set get bot config
command: |
git config --global user.name buildbot
- run:
# the helmchart git repo hosts the helm repository (gh-pages) Chart releaser only supports https clone, not ssh
name: Clone Helmchart Repo
command: git clone https://github.com/pachyderm/helmchart.git helmchart
- when:
condition:
and:
- equal: [true, << parameters.preview >>]
steps:
- run:
name: publish preview helm chart
command: |
cr upload -o pachyderm -r helmchart --package-path cr-release-packages/preview --skip-existing
cd helmchart && cr index -o pachyderm -r helmchart -c https://helm.pachyderm.com --package-path ../cr-release-packages/preview --push
- when:
condition:
and:
- equal: [false, << parameters.preview >>]
steps:
- run:
name: publish official helm chart
command: |
cr upload -o pachyderm -r helmchart --package-path cr-release-packages/official --skip-existing
cd helmchart && cr index -o pachyderm -r helmchart -c https://helm.pachyderm.com --package-path ../cr-release-packages/official --push
nightly-load:
parameters:
bucket:
type: string
env:
type: string
resource_class: large
machine:
image: << pipeline.parameters.machine_image >>
environment:
TEST_ENV: << parameters.env >>
BUCKET: << parameters.bucket >>
GOOGLE_PROJECT_ID: build-release-001
GOOGLE_COMPUTE_ZONE: us-east1-b
GOOGLE_COMPUTE_REGION: us-east1
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- gcp-cli/initialize
- go/install:
version: << pipeline.parameters.go-version >>
- install-pulumi-deps
- run: |
echo "$DOCKER_PWD" | docker login --username pachydermbuildbot --password-stdin
- run:
command: etc/testing/circle/run_all_load_tests.sh
no_output_timeout: 1h
- install-go-releaser
- run:
name: Destroy test env on fail
command: |
sleep 300 #wait for CNI warm pool population to acquiesce before destroy
pulumi destroy --yes --stack << parameters.env >> --cwd etc/testing/circle/workloads/pulumi/aws
when: on_fail
- store_artifacts:
path: /tmp/debug-dump
destination: debug-dump
rootless:
resource_class: xlarge
machine:
image: << pipeline.parameters.machine_image >>
environment:
TEST_RESULTS: /tmp/test-results
steps:
- checkout
- go/install:
version: << pipeline.parameters.go-version >>
- run:
name: setup env vars
command: |
echo 'export GOCACHE=/home/circleci/.gocache' >> $BASH_ENV
echo 'export GOPATH=/home/circleci/.go_workspace' >> $BASH_ENV
echo 'export PATH=/home/circleci/project/cached-deps:$PATH' >> $BASH_ENV
echo 'export PATH=$GOPATH/bin:$PATH' >> $BASH_ENV
echo 'export TEST_IMAGE_SHA=$CIRCLE_SHA1' >> $BASH_ENV
- run: etc/testing/circle/install.sh
- install-go-releaser
- run:
name: Collect node stats
command: sar 10 -BbdHwzS -I SUM -n DEV -q -r ALL -u ALL -h
background: true
- run: mkdir ${TEST_RESULTS}
- wait-for-docker
- start-minikube-large
- run:
name: Wait for docker images to be built
command: etc/testing/circle/wait_for_docker_images.sh
- run: etc/testing/circle/wait-minikube.sh
- run: etc/testing/circle/rootless_test.sh | ts '%Y-%m-%dT%H:%M:%S'
- run:
name: Format test results for upload
command: go tool test2json -t < "/tmp/go-test-results.txt" > "${TEST_RESULTS}/go-test-results.jsonl" || true
when: always
- run:
name: Format code coverage
when: always
command: etc/testing/circle/format-coverage.sh
- store_artifacts:
path: /tmp/test-results
destination: raw-test-output
- run:
name: Dump debugging info in case of failure
when: on_fail
command: etc/testing/circle/kube_debug.sh
- collect-test-results
- codecov/upload:
file: /tmp/test-results/coverage.txt
deploy-tests: # run only arm64 now that integration test runs these
parameters:
num_executors:
type: integer
default: 2
resource_class:
type: string
default: large
arch:
type: string
default: arm64
resource_class: << parameters.resource_class >>
parallelism: << parameters.num_executors >>
machine:
image: << pipeline.parameters.machine_image >>
environment:
TEST_RESULTS: /tmp/test-results
steps:
- checkout
# go/install doesn't support arm64 yet
- run:
name: install go
command: |
sudo rm -rf /usr/local/go && curl --fail --location -sS "https://dl.google.com/go/go<< pipeline.parameters.go-version >>.linux-<< parameters.arch >>.tar.gz" | sudo tar --no-same-owner -xz -C /usr/local
echo "export PATH=$PATH:/usr/local/go/bin" >> "$BASH_ENV"
sudo chown -R "$(whoami)": /usr/local/go
echo "Installed " && go version
- run:
name: setup env vars
command: |
echo 'export GOCACHE=/home/circleci/.gocache' >> $BASH_ENV
echo 'export GOPATH=/home/circleci/.go_workspace' >> $BASH_ENV
echo 'export PATH=/home/circleci/project/cached-deps:$PATH' >> $BASH_ENV
echo 'export PATH=$GOPATH/bin:$PATH' >> $BASH_ENV
if [[ "$CIRCLE_BRANCH" -eq "" ]] && [[ "$CIRCLE_TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(.*) ]]
then
echo 'export TEST_IMAGE_SHA=$CIRCLE_SHA1' >> $BASH_ENV
else
echo 'export TEST_IMAGE_SHA=cover-$CIRCLE_SHA1' >> $BASH_ENV
fi
- restore_cache:
keys:
- pach-build-dependencies-v2-{{ arch }}-{{ checksum "etc/testing/circle/install.sh" }}
- run: etc/testing/circle/install.sh
- run:
name: Collect node stats
command: sar 10 -BbdHwzS -I SUM -n DEV -q -r ALL -u ALL -h
background: true
- run: mkdir -p "${TEST_RESULTS}"
- wait-for-docker
- start-minikube-large
# The build cache will grow indefinitely, so we rotate the cache once a week.
# This ensures the time to restore the cache isn't longer than the speedup in compilation.
- run: "echo $(($(date +%s)/604800)) > current_week"
- restore_cache:
keys:
- pach-go-build-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "current_week" }}
- pach-go-build-cache-v1-master-{{ arch }}-{{ checksum "current_week" }}
# Only restore the module cache based on an exact match for go.sum.
# This also avoids accumulating old versions of modules over time.
# Note: This gets saves in the main test runs, no need to save here
- restore_cache:
keys:
- pach-go-mod-cache-v2-{{ arch }}-{{ checksum "go.sum" }}
- run: make install # Install pachctl
- save_cache:
key: pach-go-build-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "current_week" }}
paths:
- /home/circleci/.gocache
- run:
name: Wait for docker images to be built
command: etc/testing/circle/wait_for_docker_images.sh
- run: etc/testing/circle/wait-minikube.sh
- run:
name: Run Tests
command: etc/testing/circle/deploy_test.sh | ts '%Y-%m-%dT%H:%M:%S'
- run:
command: etc/testing/circle/upload_stats.sh
when: always
- run:
name: Format test results for upload
command: go tool test2json -t < "/tmp/go-test-results.txt" > "${TEST_RESULTS}/go-test-results.jsonl" || true
when: always
- run:
name: Dump debugging info in case of failure
when: on_fail
command: etc/testing/circle/kube_debug.sh
- store_artifacts:
path: /tmp/test-results
- run:
name: Format code coverage
when: always
command: etc/testing/circle/format-coverage.sh
- store_test_results:
path: /tmp/test-results
- store_artifacts:
path: /tmp/test-results
- collect-test-results
- codecov/upload:
file: /tmp/test-results/coverage.txt
# build pachctl and push to GCS bucket, so that it can be bundled into the
# Jupyter-Pachyderm extension
build-docker-images:
parameters:
appVersion:
type: string
default: "0.0.0"
enableCoverage:
type: boolean
default: false
machine:
image: << pipeline.parameters.machine_image >>
docker_layer_caching: true
resource_class: xlarge
steps:
- go/install:
version: << pipeline.parameters.go-version >>
- checkout
- run:
name: Download utilities
command: |
sudo apt update
sudo apt install qemu binfmt-support qemu-user-static
- install-go-releaser
- run:
name: pachydermbuildbot docker login
command: |
echo "$DOCKER_PWD" | docker login --username pachydermbuildbot --password-stdin
- run:
name: Build Docker
command: |
v=<< parameters.appVersion >>
additional=${v%%-*}
index=${#additional}
if << parameters.enableCoverage >>
then
make docker-build-coverage VERSION=${v} VERSION_ADDITIONAL=${v:index}
else
make docker-build VERSION=${v} VERSION_ADDITIONAL=${v:index}
fi
- run:
name: Push docker
command: |-
if << parameters.enableCoverage >>
then
make docker-push VERSION=cover-${CIRCLE_SHA1}
else
make docker-push VERSION=${CIRCLE_SHA1}
fi
build-pachctl-bin:
parameters:
version:
type: string
upload:
description: Determines if this job should perform an extra step to upload bin to a gcp bucket.
type: boolean
default: false
resource_class: large
executor: docker-go
steps:
- checkout
- run:
name: Download utilities
command: |
mkdir -p /home/circleci/bin
wget https://github.com/chainlink/gcsupload/releases/download/v0.2.0/gcsupload_0.2.0_Linux_x86_64.tar.gz
tar zxvf gcsupload_0.2.0_Linux_x86_64.tar.gz -C /home/circleci/bin gcsupload
rm -rf gcsupload_0.2.0_Linux_x86_64.tar.gz
echo 'export PATH=/home/circle/bin:$PATH' >> $BASH_ENV
# The build cache will grow indefinitely, so we rotate the cache once a week.
# This ensures the time to restore the cache isn't longer than the speedup in compilation.
- run: "echo $(($(date +%s)/604800)) > current_week"
- restore_cache:
keys:
- pachctl-build-cache-v1-{{ .Branch }}-{{ checksum "current_week" }}
- pachctl-build-cache-v1-master-{{ checksum "current_week" }}
- install-go-releaser
- when:
condition:
and:
- equal: [true, << parameters.upload >>]
steps:
- run:
name: build pachctl bin
description: Builds and uploads pachctl amd64 binary for extensions with a git commit SHA.
command: |
make release-pachctl GORELSNAP=--snapshot VERSION=<< parameters.version >>
- run:
name: upload pachctl binaries
command: |
echo $PACHCTL_GOOGLE_UPLOAD_CREDS > /home/circleci/gcpcreds.json
cd /home/circleci/dist-pach/pachctl/
gcsupload -b pachyderm-builds -f `find * -name \*amd64.tar.gz` -k /home/circleci/gcpcreds.json
rm /home/circleci/gcpcreds.json
- when:
condition:
and:
- equal: [false, << parameters.upload >>]
steps:
- run:
name: build pachctl bin
description: Builds and prepares all pachctl binaries for release.
command: |
v=<< parameters.version >>
additional=${v%%-*}
index=${#additional}
make release-pachctl GORELSNAP=--snapshot VERSION=${v} VERSION_ADDITIONAL=${v:index}
- persist_to_workspace:
root: ../
paths:
- dist-pach/*
- save_cache:
key: pachctl-build-cache-v1-{{ .Branch }}-{{ checksum "current_week" }}
paths:
- /home/circleci/.cache # Note, this is different from the cache location for the machine executors
check-prettier:
docker:
- image: cimg/node:20.11.0
steps:
- checkout
- run: sudo npm install -g prettier
- run: prettier -c etc/helm/pachyderm/values.yaml .circleci/config.yml .circleci/main.yml
jsonnet-lint:
resource_class: small
docker:
- image: cimg/go:<< pipeline.parameters.go-version >>
steps:
- checkout
- run:
name: Install go-jsonnet
command: |
go install github.com/google/go-jsonnet/cmd/jsonnet-lint@latest
- run:
name: lint all jsonnet files
command: |
find . -maxdepth 10 -name \*.jsonnet | xargs jsonnet-lint
test-envoy:
docker:
- image: envoyproxy/envoy:v1.29.1
entrypoint: /bin/sh
steps:
- run: apt update
- run: DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt install -y make wget git ssh
- checkout
- run: wget https://github.com/google/jsonnet/releases/download/v0.17.0/jsonnet-bin-v0.17.0-linux.tar.gz
- run: tar xzvf jsonnet-bin-v0.17.0-linux.tar.gz
- run: mv jsonnet jsonnetfmt /usr/local/bin
- run: make -C etc/generate-envoy-config test
govulncheck:
executor: docker-go
resource_class: xlarge
steps:
- checkout
- run:
name: Install govulncheck
command: go install golang.org/x/vuln/cmd/govulncheck@latest
- run:
name: Check for known security vulnerabilities
command: |
find -name go.mod -print0 | xargs -0 -I{} sh -c 'cd $(dirname {}); echo; echo '---'; echo $PWD; exec govulncheck ./...'
jupyter-extension-test:
parameters:
python-version:
type: string
docker:
- image: cimg/python:<< parameters.python-version >>-node
working_directory: ~/project/jupyter-extension
steps:
- checkout:
path: ~/project
- run:
name: "Install Python dependencies"
command: |
python -m venv venv
. venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r ci-requirements.txt
# Install and cache Node dependencies
- restore_cache:
keys:
- node-cache-v3-{{ checksum "package-lock.json" }}
- node-cache-v3
- run:
name: "Install npm packages"
command: |
npm ci
- save_cache:
key: node-cache-v3-{{ checksum "package-lock.json" }}
paths:
- "node_modules"
- run:
name: "Build and test the extension"
command: |
set -eux
. venv/bin/activate
npm run eslint:check
python -m pip install -e '.[dev]'
# Run Python unit tests
mkdir -p test-results
# pytest -v \
# --ignore jupyterlab_pachyderm/tests/test_integrations.py \
# --junitxml=test-results/junit.xml \
# jupyterlab_pachyderm
check-manifest -v
- store_test_results:
path: test-results
- store_artifacts:
path: test-results
jupyter-extension-integration-test:
resource_class: xlarge
machine:
image: << pipeline.parameters.machine_image >>
working_directory: ~/project/jupyter-extension
steps:
- checkout:
path: ~/project
- install-jupyter-test-deps
- run:
name: "Integration tests"
command: |
set -eux
python3 -m venv venv
. venv/bin/activate
python3 -m pip install -e '.[dev]'
nohup pachctl port-forward &
touch /tmp/mount-server.log # mount-server will truncate on startup
tail -F /tmp/mount-server.log &
export MOUNT_SERVER_LOG_FILE=/tmp/mount-server.log \
mkdir pfs
export PFS_MOUNT_DIR=$(pwd)/pfs
# Run integration tests
mkdir -p test-results
pytest -v \
--junitxml=test-results/junit.xml \
jupyterlab_pachyderm/tests
- store_test_results:
path: test-results
- store_artifacts:
path: test-results
jupyter-extension-e2e-test:
resource_class: xlarge
machine:
image: << pipeline.parameters.machine_image >>
working_directory: ~/project/jupyter-extension
steps:
- checkout:
path: ~/project
- attach_workspace:
at: .
- install-jupyter-test-deps
- run:
name: "e2e tests"
command: |
set -eux
python3 -m venv venv
. venv/bin/activate
python -m pip install --upgrade pip
pip install jupyterlab==3.2.2
pip install `find dist/ -name \*.whl`
# Install just what need to run cypress tests
npm install cypress@^10.11.0
npm install start-server-and-test@^1.14.0
# Enable the examples extension
mkdir -p /home/circleci/.jupyter/labconfig
cp ./scripts/page_config.json /home/circleci/.jupyter/labconfig
echo '{"pachd_address": "grpc://'"$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' kind-control-plane)":30650'", "source": 2}' | pachctl config set context "mount-server" --overwrite && pachctl config set active-context "mount-server"
pachctl create repo images
pachctl put file images@master:liberty.png -f https://docs.pachyderm.com/images/opencv/liberty.jpg
pachctl put file images@branch:branch.png -f https://docs.pachyderm.com/images/opencv/liberty.jpg
pachctl list repo
mkdir pfs
export PFS_MOUNT_DIR=$(pwd)/pfs
CI=true CYPRESS_RECORD_KEY=$JUPYTERLAB_PACHYDERM_CYPRESS_RECORD_KEY npm run e2e
- when:
condition: on_fail
steps:
- store_artifacts:
path: cypress/videos/
- store_artifacts:
path: cypress/screenshots/
jupyter-extension-frontend-test:
resource_class: xlarge
docker:
- image: cimg/node:20.11.0
working_directory: ~/project/jupyter-extension
steps:
- checkout:
path: ~/project
- run: npm ci
- run: npm run test
jupyter-extension-build:
executor: python
working_directory: ~/project/jupyter-extension
steps:
- checkout:
path: ~/project
- run:
name: Install JQ
command: |
wget https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
chmod +x jq-linux64
mv jq-linux64 /home/circleci/bin/jq
- run:
name: Set version
command: |
if [[ ! -z $CIRCLE_TAG ]];
then
contents="$(jq --arg version ${CIRCLE_TAG:1} '.version = $version' package.json)" && echo "${contents}" > package.json
fi
- run:
name: "Install Python dependencies"
command: |
python -m venv venv
. venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r ci-requirements.txt
# Install and cache Node dependencies
- restore_cache:
keys:
- node-cache-v3-{{ checksum "package-lock.json" }}
- node-cache-v3
- run:
name: "Install npm packages"
command: |
npm ci
- save_cache:
key: node-cache-v3-{{ checksum "package-lock.json" }}
paths:
- "node_modules"
- run:
name: build
command: |
python -m venv venv
. venv/bin/activate
python -m build
- persist_to_workspace:
root: .
paths:
- dist
jupyter-extension-test-publish:
executor: python
working_directory: ~/project/jupyter-extension
steps:
- checkout:
path: ~/project
- attach_workspace:
at: .
- run:
name: "Install Python dependencies"
command: |
python -m venv venv
. venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r ci-requirements.txt
- run:
name: Init .pypirc
command: |
echo -e "[testpypi]" >> ~/.pypirc
echo -e "username = $PYPI_USERNAME" >> ~/.pypirc
echo -e "password = $TEST_PYPI_PASSWORD" >> ~/.pypirc
- run:
name: Publish
command: |
python -m venv venv
. venv/bin/activate
twine upload --repository testpypi dist/*
jupyter-extension-publish:
executor: python
working_directory: ~/project/jupyter-extension
steps:
- checkout:
path: ~/project
- attach_workspace:
at: .
- run:
name: "Install Python dependencies"
command: |
python -m venv venv
. venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r ci-requirements.txt
- run:
name: Init .pypirc
command: |
echo -e "[pypi]" >> ~/.pypirc
echo -e "username = $PYPI_USERNAME" >> ~/.pypirc
echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
- run:
name: Publish
command: |
python -m venv venv
. venv/bin/activate
twine upload dist/*
jupyter-extension-docker-build:
executor: python
working_directory: ~/project/jupyter-extension
steps:
- checkout: