forked from pachyderm/pachyderm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
765 lines (621 loc) · 27.5 KB
/
Makefile
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
#### VARIABLES
# RUNARGS: arguments for run
# DOCKER_OPTS: docker-compose options for run, test, launch-*
# TESTPKGS: packages for test, default ./src/...
# TESTFLAGS: flags for test
# KUBECTLFLAGS: flags for kubectl
# DOCKER_BUILD_FLAGS: flags for 'docker build'
####
ifndef TESTPKGS
TESTPKGS = ./src/...
endif
COMPILE_RUN_ARGS = -d -v /var/run/docker.sock:/var/run/docker.sock --privileged=true
# Label it w the go version we bundle in:
COMPILE_IMAGE = "pachyderm/compile:$(shell cat etc/compile/GO_VERSION)"
export VERSION_ADDITIONAL = -$(shell git log --pretty=format:%H | head -n 1)
LD_FLAGS = -X github.com/pachyderm/pachyderm/src/client/version.AdditionalVersion=$(VERSION_ADDITIONAL)
GC_FLAGS = "all=-trimpath=${PWD}"
export DOCKER_BUILD_FLAGS
CLUSTER_NAME?=pachyderm
CLUSTER_MACHINE_TYPE?=n1-standard-4
CLUSTER_SIZE?=4
BENCH_CLOUD_PROVIDER=aws
MINIKUBE_MEM=8192 # MB of memory allocated to minikube
MINIKUBE_CPU=4 # Number of CPUs allocated to minikube
ETCD_IMAGE=quay.io/coreos/etcd:v3.3.5
ifdef TRAVIS_BUILD_NUMBER
# Upper bound for travis test timeout
TIMEOUT = 3600s
else
ifndef TIMEOUT
# You should be able to specify your own timeout, but by default we'll use the same bound as travis
TIMEOUT = 3600s
endif
endif
echo-timeout:
echo $(TIMEOUT)
all: build
version:
@echo 'package main; import "github.com/pachyderm/pachyderm/src/client/version"; func main() { println(version.PrettyPrintVersion(version.Version)) }' > /tmp/pachyderm_version.go
go run /tmp/pachyderm_version.go
deps:
go get -d -v ./src/... ./.
update-deps:
go get -d -v -u ./src/... ./.
build:
GO111MODULE=on go build -mod vendor $$(go list ./src/client/... | grep -v '/src/client$$')
pachd:
go build ./src/server/cmd/pachd
worker:
go build ./src/server/cmd/worker
install:
# GOPATH/bin must be on your PATH to access these binaries:
GO111MODULE=on go install -mod vendor -ldflags "$(LD_FLAGS)" -gcflags "$(GC_FLAGS)" ./src/server/cmd/pachctl
install-mac:
# Result will be in $GOPATH/bin/darwin_amd64/pachctl (if building on linux)
GO111MODULE=on GOOS=darwin GOARCH=amd64 go install -ldflags "$(LD_FLAGS)" -gcflags "$(GC_FLAGS)" ./src/server/cmd/pachctl
install-clean:
@# Need to blow away pachctl binary if its already there
@rm -f $(GOPATH)/bin/pachctl
@make install
install-doc:
GO111MODULE=on go install -gcflags "$(GC_FLAGS)" ./src/server/cmd/pachctl-doc
check-docker-version:
# The latest docker client requires server api version >= 1.24.
# However, minikube uses 1.23, so if you're connected to minikube, releases
# may break
@ \
docker_major="$$(docker version -f "{{.Server.APIVersion}}" | cut -d. -f1)"; \
docker_minor="$$(docker version -f "{{.Server.APIVersion}}" | cut -d. -f2)"; \
echo "docker version = $${docker_major}.$${docker_minor}, need at least 1.24"; \
test \( "$${docker_major}" -gt 1 \) -o \( "$${docker_minor}" -ge 24 \)
point-release:
@make VERSION_ADDITIONAL= release-helper
@make VERSION_ADDITIONAL= release-pachctl
@make doc
@rm VERSION
@echo "Release completed"
# Run via 'make VERSION_ADDITIONAL=rc2 release-custom' to specify a version string
release-candidate:
@make release-helper
@make release-pachctl-custom
@make doc
@rm VERSION
@echo "Release completed"
custom-release: release-helper release-pachctl-custom
@echo 'For brew install, do:'
@echo "$$ brew install https://raw.githubusercontent.com/pachyderm/homebrew-tap/$$(cat VERSION)-$$(git log --pretty=format:%H | head -n 1)/pachctl@$$(cat VERSION | cut -f -2 -d\.).rb"
@echo 'For linux install, do:'
@echo "$$ curl -o /tmp/pachctl.deb -L https://github.com/pachyderm/pachyderm/releases/download/v$$(cat VERSION)/pachctl_$$(cat VERSION)_amd64.deb && sudo dpkg -i /tmp/pachctl.deb"
# Workaround for https://github.com/laher/goxc/issues/112
@git push origin :v$$(cat VERSION)
@git tag v$$(cat VERSION)
@git push origin --tags
@rm VERSION
@echo "Release completed"
release-pachctl-custom:
@# Run pachctl release script w deploy branch name
@VERSION="$$(cat VERSION)" ./etc/build/release_pachctl $$(cat VERSION)
release-pachctl:
@# Run pachctl release script w deploy branch name
@VERSION="$(shell cat VERSION)" ./etc/build/release_pachctl
release-helper: check-docker-version release-version release-pachd release-worker
release-version: install-clean
@./etc/build/release_version
release-pachd:
@VERSION="$(shell cat VERSION)" ./etc/build/release_pachd
release-worker:
@VERSION="$(shell cat VERSION)" ./etc/build/release_worker
docker-build-compile:
docker build $(DOCKER_BUILD_FLAGS) -t pachyderm_compile .
# To bump this, update the etc/compile/GO_VERSION file
publish-compile: docker-build-compile
docker tag pachyderm_compile $(COMPILE_IMAGE)
docker push $(COMPILE_IMAGE)
docker-clean-worker:
docker stop worker_compile || true
docker rm worker_compile || true
docker-build-worker: docker-clean-worker
docker run \
-v $(PWD):/go/src/github.com/pachyderm/pachyderm \
-v $$GOPATH/pkg:/go/pkg \
-v $$HOME/.cache/go-build:/root/.cache/go-build \
--name worker_compile $(COMPILE_RUN_ARGS) $(COMPILE_IMAGE) /go/src/github.com/pachyderm/pachyderm/etc/compile/compile.sh worker "$(LD_FLAGS)"
docker-wait-worker:
etc/compile/wait.sh worker_compile
docker-clean-pachd:
docker stop pachd_compile || true
docker rm pachd_compile || true
docker-build-pachd: docker-clean-pachd
docker run \
-v $(PWD):/go/src/github.com/pachyderm/pachyderm \
-v $$GOPATH/pkg:/go/pkg \
-v $$HOME/.cache/go-build:/root/.cache/go-build \
--name pachd_compile $(COMPILE_RUN_ARGS) $(COMPILE_IMAGE) /go/src/github.com/pachyderm/pachyderm/etc/compile/compile.sh pachd "$(LD_FLAGS)"
docker-clean-test:
docker stop test_compile || true
docker rm test_compile || true
docker-build-test: docker-clean-test docker-build-compile
@# build the pachyderm_test_buildenv container
etc/compile/compile_test.sh --make-env
mkdir ./_tmp || true
@# build pachyderm_test container (don't use COMPILE_RUN_ARGS b/c we don't
@# want to run this as a daemon container
docker run \
--attach stdout \
--attach stderr \
--rm \
-w /go/src/github.com/pachyderm/pachyderm \
-v $$GOPATH/src/github.com/pachyderm/pachyderm:/go/src/github.com/pachyderm/pachyderm \
-v $$HOME/.cache/go-build:/root/.cache/go-build \
-v /var/run/docker.sock:/var/run/docker.sock \
--privileged=true \
--name test_compile \
pachyderm_test_buildenv sh /go/src/github.com/pachyderm/pachyderm/etc/compile/compile_test.sh
docker tag pachyderm_test:latest pachyderm/test:`git rev-list HEAD --max-count=1`
docker-push-test:
docker push pachyderm/test:`git rev-list HEAD --max-count=1`
docker-wait-pachd:
etc/compile/wait.sh pachd_compile
docker-build-helper: enterprise-code-checkin-test
@# run these in separate make process so that if
@# 'enterprise-code-checkin-test' fails, the rest of the build process aborts
@make docker-build-worker docker-build-pachd docker-wait-worker docker-wait-pachd
docker-build:
docker pull $(COMPILE_IMAGE)
make docker-build-helper
docker-build-proto:
docker build $(DOCKER_BUILD_FLAGS) -t pachyderm_proto etc/proto
docker-build-netcat:
docker build $(DOCKER_BUILD_FLAGS) -t pachyderm_netcat etc/netcat
docker-build-gpu:
docker build $(DOCKER_BUILD_FLAGS) -t pachyderm_nvidia_driver_install etc/deploy/gpu
docker tag pachyderm_nvidia_driver_install pachyderm/nvidia_driver_install
docker-build-kafka:
cp -R vendor/github.com/segmentio/kafka-go etc/testing/kafka
docker build -t kafka-demo etc/testing/kafka || { rm -r etc/testing/kafka/kafka-go; exit 1; }
rm -r etc/testing/kafka/kafka-go
docker-push-gpu:
docker push pachyderm/nvidia_driver_install
docker-push-gpu-dev:
docker tag pachyderm/nvidia_driver_install pachyderm/nvidia_driver_install:`git rev-list HEAD --max-count=1`
docker push pachyderm/nvidia_driver_install:`git rev-list HEAD --max-count=1`
echo pushed pachyderm/nvidia_driver_install:`git rev-list HEAD --max-count=1`
docker-gpu: docker-build-gpu docker-push-gpu
docker-gpu-dev: docker-build-gpu docker-push-gpu-dev
docker-build-test-entrypoint:
docker build $(DOCKER_BUILD_FLAGS) -t pachyderm_entrypoint etc/testing/entrypoint
check-kubectl:
@# check that kubectl is installed
@which kubectl >/dev/null || { \
echo "error: kubectl not found"; \
exit 1; \
}
check-kubectl-connection:
kubectl $(KUBECTLFLAGS) get all > /dev/null
launch-dev-bench: docker-build docker-build-test install
@# Put it here so sudo can see it
rm /usr/local/bin/pachctl || true
ln -s $(GOPATH)/bin/pachctl /usr/local/bin/pachctl
make launch-bench
build-bench-images: docker-build docker-build-test
push-bench-images: install-bench tag-images push-images
# We need the pachyderm_compile image to be up to date
docker tag pachyderm_test pachyderm/bench:`git rev-list HEAD --max-count=1`
docker push pachyderm/bench:`git rev-list HEAD --max-count=1`
tag-images: install
docker tag pachyderm_pachd pachyderm/pachd:`$(GOPATH)/bin/pachctl version --client-only`
docker tag pachyderm_worker pachyderm/worker:`$(GOPATH)/bin/pachctl version --client-only`
push-images: tag-images
docker push pachyderm/pachd:`$(GOPATH)/bin/pachctl version --client-only`
docker push pachyderm/worker:`$(GOPATH)/bin/pachctl version --client-only`
launch-bench:
@# Make launches each process in its own shell process, so we have to structure
@# these to run these as one command
ID=$$( etc/testing/deploy/$(BENCH_CLOUD_PROVIDER).sh --create | tail -n 1); \
@echo To delete this cluster, run etc/testing/deploy/$(BENCH_CLOUD_PROVIDER).sh --delete=$${ID}; \
echo etc/testing/deploy/$(BENCH_CLOUD_PROVIDER).sh --delete=$${ID} >./clean_current_bench_cluster.sh; \
until timeout 10s ./etc/kube/check_ready.sh app=pachd; do sleep 1; done; \
cat ~/.kube/config;
clean-launch-bench:
./clean_current_bench_cluster.sh || true
install-bench: install
@# Since bench is run as sudo, pachctl needs to be under
@# the secure path
rm /usr/local/bin/pachctl || true
[ -f /usr/local/bin/pachctl ] || sudo ln -s $(GOPATH)/bin/pachctl /usr/local/bin/pachctl
launch-dev-test: docker-build-test docker-push-test
kubectl run pachyderm-test --image=pachyderm/test:`git rev-list HEAD --max-count=1` \
--rm \
--restart=Never \
--attach=true \
-- \
./test -test.v
aws-test: tag-images push-images
ZONE=sa-east-1a etc/testing/deploy/aws.sh --create
$(MAKE) launch-dev-test
rm $(HOME)/.pachyderm/config.json
ZONE=sa-east-1a etc/testing/deploy/aws.sh --delete
run-bench:
kubectl scale --replicas=4 deploy/pachd
echo "waiting for pachd to scale up" && sleep 15
kubectl delete --ignore-not-found po/bench && \
kubectl run bench \
--image=pachyderm/bench:`git rev-list HEAD --max-count=1` \
--image-pull-policy=Always \
--restart=Never \
--attach=true \
-- \
PACH_TEST_CLOUD=true ./test -test.v -test.bench=BenchmarkDaily -test.run=`etc/testing/passing_test_regex.sh`
delete-all-launch-bench:
etc/testing/deploy/$(BENCH_CLOUD_PROVIDER).sh --delete-all
bench: clean-launch-bench build-bench-images push-bench-images launch-bench run-bench clean-launch-bench
launch-kube: check-kubectl
etc/kube/start-minikube.sh
launch-dev-vm: check-kubectl
@# Make sure the caller sets address to avoid confusion later
@if [ -z "${PACHD_ADDRESS}" ]; then \
$$( which echo ) -e "Must set PACHD_ADDRESS\nRun:\nexport PACHD_ADDRESS=192.168.99.100:30650"; \
exit 1; \
fi
@if [ -n "${PACH_CA_CERTS}" ]; then \
$$( which echo ) -e "Must unset PACH_CA_CERTS\nRun:\nunset PACH_CA_CERTS"; \
exit 1; \
fi
# Making sure minikube isn't still up from a previous run...
@if minikube ip 2>/dev/null || sudo minikube ip 2>/dev/null; \
then \
echo "minikube is still up. Run 'make clean-launch-kube'"; \
exit 1; \
fi
etc/kube/start-minikube-vm.sh --cpus=$(MINIKUBE_CPU) --memory=$(MINIKUBE_MEM)
# launch-release-vm is like launch-dev-vm but it doesn't build pachctl locally, and uses the same
# version of pachd associated with the current pachctl (useful if you want to start a VM with a
# point-release version of pachd, instead of whatever's in the current branch)
launch-release-vm:
@# Make sure the caller sets address to avoid confusion later
@if [ -z "${PACHD_ADDRESS}" ]; then \
$$( which echo ) -e "Must set PACHD_ADDRESS\nRun:\nexport PACHD_ADDRESS=192.168.99.100:30650"; \
exit 1; \
fi
@if [ -n "${PACH_CA_CERTS}" ]; then \
$$( which echo ) -e "Must unset PACH_CA_CERTS\nRun:\nunset PACH_CA_CERTS"; \
exit 1; \
fi
# Making sure minikube isn't still up from a previous run...
@if minikube ip 2>/dev/null || sudo minikube ip 2>/dev/null; \
then \
echo "minikube is still up. Run 'make clean-launch-kube'"; \
exit 1; \
fi
etc/kube/start-minikube-vm.sh --cpus=$(MINIKUBE_CPU) --memory=$(MINIKUBE_MEM) --tag=v$$(pachctl version --client-only)
clean-launch-kube:
@# clean up both of the following cases:
@# make launch-dev-vm - minikube config is owned by $USER
@# make launch-kube - minikube config is owned by root
minikube ip 2>/dev/null && minikube delete || true
sudo minikube ip 2>/dev/null && sudo minikube delete || true
killall kubectl || true
launch: install check-kubectl
$(eval STARTTIME := $(shell date +%s))
pachctl deploy local --dry-run | kubectl $(KUBECTLFLAGS) apply -f -
# wait for the pachyderm to come up
until timeout 1s ./etc/kube/check_ready.sh app=pachd; do sleep 1; done
@echo "pachd launch took $$(($$(date +%s) - $(STARTTIME))) seconds"
launch-dev: check-kubectl check-kubectl-connection install
$(eval STARTTIME := $(shell date +%s))
pachctl deploy local --no-guaranteed -d --dry-run $(LAUNCH_DEV_ARGS) | kubectl $(KUBECTLFLAGS) apply -f -
# wait for the pachyderm to come up
until timeout 1s ./etc/kube/check_ready.sh app=pachd; do sleep 1; done
@echo "pachd launch took $$(($$(date +%s) - $(STARTTIME))) seconds"
clean-launch: check-kubectl install
yes | pachctl undeploy
clean-launch-dev: check-kubectl install
yes | pachctl undeploy
full-clean-launch: check-kubectl
kubectl $(KUBECTLFLAGS) delete --ignore-not-found job -l suite=pachyderm
kubectl $(KUBECTLFLAGS) delete --ignore-not-found all -l suite=pachyderm
kubectl $(KUBECTLFLAGS) delete --ignore-not-found serviceaccount -l suite=pachyderm
kubectl $(KUBECTLFLAGS) delete --ignore-not-found secret -l suite=pachyderm
launch-test-rethinkdb:
@# Expose port 8081 so you can connect to the rethink dashboard
@# (You may need to forward port 8081 if you're running docker machine)
docker run --name pachyderm-test-rethinkdb -d -p 28015:28015 -p 8081:8080 rethinkdb:2.3.3
sleep 20 # wait for rethinkdb to start up
clean-launch-test-rethinkdb:
docker stop pachyderm-test-rethinkdb || true
docker rm pachyderm-test-rethinkdb || true
clean-pps-storage: check-kubectl
kubectl $(KUBECTLFLAGS) delete pvc rethink-volume-claim
kubectl $(KUBECTLFLAGS) delete pv rethink-volume
integration-tests:
CGOENABLED=0 go test -v ./src/server $(TESTFLAGS) -timeout $(TIMEOUT)
test-proto-static:
./etc/proto/test_no_changes.sh
proto: docker-build-proto
find src -regex ".*\.proto" \
| xargs tar cf - \
| docker run -i pachyderm_proto \
| tar xf -
# Use this to grab a binary for profiling purposes
pachd-profiling-binary: docker-clean-pachd docker-build-compile
docker run -i $(COMPILE_IMAGE) sh etc/compile/compile.sh pachd "$(LD_FLAGS)" PROFILE \
| tar xf -
# Binary emitted to ./pachd
pretest:
go get -v github.com/kisielk/errcheck
go vet -n ./src/... | while read line; do \
modified=$$(echo $$line | sed "s/ [a-z0-9_/]*\.pb\.gw\.go//g"); \
$$modified; \
if [ -n "$$($$modified)" ]; then \
exit 1; \
fi; \
done
#errcheck $$(go list ./src/... | grep -v src/cmd/ppsd | grep -v src/pfs$$ | grep -v src/pps$$)
local-test: docker-build launch-dev test-pfs clean-launch-dev
# Run all the tests. Note! This is no longer the test entrypoint for travis
test: clean-launch-dev launch-dev lint enterprise-code-checkin-test docker-build test-pfs-server test-pfs-cmds test-deploy-cmds test-libs test-vault test-auth test-enterprise test-worker test-admin test-pps
enterprise-code-checkin-test:
@which ag || { printf "'ag' not found. Run:\n sudo apt-get install -y silversearcher-ag\n brew install the_silver_searcher\nto install it\n\n"; exit 1; }
# Check if our test activation code is anywhere in the repo
@echo "Files containing test Pachyderm Enterprise activation token:"; \
if ag --ignore=Makefile -p .gitignore 'RM2o1Qit6YlZhS1RGdXVac'; \
then \
$$( which echo ) -e "\n*** It looks like Pachyderm Engineering's test activation code may be in this repo. Please remove it before committing! ***\n"; \
false; \
fi
test-pfs-server:
./etc/testing/pfs_server.sh $(ETCD_IMAGE) $(TIMEOUT)
test-pfs-cmds:
@# Unlike test-pfs-server, this target requires a running cluster
go test ./src/server/pfs/cmds -count 1 -timeout $(TIMEOUT)
test-pfs-storage:
go test ./src/server/pkg/storage/chunk -count 1 -timeout $(TIMEOUT)
go test ./src/server/pkg/storage/fileset/index -count 1 -timeout $(TIMEOUT)
go test ./src/server/pkg/storage/fileset -count 1 -timeout $(TIMEOUT)
test-deploy-cmds:
go test ./src/server/pkg/deploy/cmds -count 1 -timeout $(TIMEOUT)
test-config:
go test ./src/server/config -count 1 -timeout $(TIMEOUT)
test-pps:
@# Travis uses the helper directly because it needs to specify a
@# subset of the tests using the run flag
@make RUN= test-pps-helper
test-pps-helper: launch-stats launch-kafka docker-build-test-entrypoint
# Use the count flag to disable test caching for this test suite.
PROM_PORT=$$(kubectl --namespace=monitoring get svc/prometheus -o json | jq -r .spec.ports[0].nodePort) \
go test -v ./src/server -parallel 1 -count 1 -timeout $(TIMEOUT) $(RUN) && \
go test -v ./src/server/pps/cmds -count 1 -timeout $(TIMEOUT)
test-transaction:
go test ./src/server/transaction/server -count 1 -timeout $(TIMEOUT)
test-client:
GO111MODULE=on go test -cover $$(go list ./src/client/...)
test-libs:
go test ./src/server/pkg/collection -timeout $(TIMEOUT) -vet=off
go test ./src/server/pkg/hashtree -timeout $(TIMEOUT)
go test ./src/server/pkg/cert -timeout $(TIMEOUT)
go test ./src/server/pkg/localcache -timeout $(TIMEOUT)
test-vault:
kill $$(cat /tmp/vault.pid) || true
./src/plugin/vault/etc/start-vault.sh
./src/plugin/vault/etc/setup-vault.sh
@# Dont cache these results as they require the pachd cluster
go test -v -count 1 ./src/plugin/vault -timeout $(TIMEOUT)
test-s3gateway-conformance:
go get github.com/pachyderm/s2
pachctl enterprise activate $$(aws s3 cp s3://pachyderm-engineering/test_enterprise_activation_code.txt -) && echo
$(GOPATH)/src/github.com/pachyderm/s2/conformance/conformance.py --s3tests-config=etc/testing/s3gateway/s3tests.yaml --ignore-config=etc/testing/s3gateway/ignore.conf --runs-dir=etc/testing/s3gateway/runs
test-s3gateway-integration:
pachctl enterprise activate $$(aws s3 cp s3://pachyderm-engineering/test_enterprise_activation_code.txt -) && echo
go test -v ./src/server/pfs/s3 -timeout $(TIMEOUT) -count 1
test-fuse:
CGOENABLED=0 GO111MODULE=on go test -cover $$(go list ./src/server/... | grep '/src/server/pfs/fuse')
test-local:
CGOENABLED=0 GO111MODULE=on go test -cover -short $$(go list ./src/server/... | grep -v '/src/server/pfs/fuse') -timeout $(TIMEOUT)
test-cli:
CGOENABLED=0 GO111MODULE=on go test -mod=vendor -v ./src/server/cmd/pachctl/cmd
test-auth:
yes | pachctl delete all
@# Dont cache these results as they require the pachd cluster
go test -v ./src/server/auth/server -count 1 -timeout $(TIMEOUT)
go test -v ./src/server/auth/cmds -count 1 -timeout $(TIMEOUT)
test-admin:
@# Dont cache these results as they require the pachd cluster
go test -v ./src/server/admin/server -count 1 -timeout $(TIMEOUT)
test-enterprise:
@# Dont cache these results as they require the pachd cluster
go test -v ./src/server/enterprise/server -count 1 -timeout $(TIMEOUT)
# TODO This is not very robust -- it doesn't work when the PACHD_ADDRESS host isn't an IPv4 address
PACHD_HOST := $(word 1,$(subst :, ,$(PACHD_ADDRESS)))
PACHD_PORT := $(word 2,$(subst :, ,$(PACHD_ADDRESS)))
test-tls:
# Pachyderm must be running when this target is called
pachctl version
# TLS is an enterprise pachyderm feature
pachctl enterprise activate $$(aws s3 cp s3://pachyderm-engineering/test_enterprise_activation_code.txt -) && echo
# Generate TLS key and re-deploy pachyderm with TLS enabled
etc/deploy/gen_pachd_tls.sh --ip=$(PACHD_HOST) --port=$(PACHD_PORT)
# Restart pachd with new cert
etc/deploy/restart_with_tls.sh --key=$(PWD)/pachd.key --cert=$(PWD)/pachd.pem
# If we can run a pipeline, TLS probably works
@# TODO actually monitor traffic with tcpdump
PACH_CA_CERTS=${PWD}/pachd.pem go test -v ./src/server -run TestPipelineWithParallelism
test-worker: launch-stats test-worker-helper
test-worker-helper:
@# Dont cache these results as they require the pachd cluster
PROM_PORT=$$(kubectl --namespace=monitoring get svc/prometheus -o json | jq -r .spec.ports[0].nodePort) \
go test -v ./src/server/worker/ -timeout $(TIMEOUT) -count 1
clean: clean-launch clean-launch-kube
doc-custom: install-doc release-version
./etc/build/doc
doc:
@make VERSION_ADDITIONAL= doc-custom
clean-launch-kafka:
kubectl delete -f etc/kubernetes-kafka -R
launch-kafka:
kubectl apply -f etc/kubernetes-kafka -R
until timeout 10s ./etc/kube/check_ready.sh app=kafka kafka; do sleep 10; done
clean-launch-stats:
kubectl delete --filename etc/kubernetes-prometheus -R
launch-stats:
kubectl apply --filename etc/kubernetes-prometheus -R
clean-launch-monitoring:
kubectl delete --ignore-not-found -f ./etc/plugin/monitoring
launch-monitoring:
kubectl create -f ./etc/plugin/monitoring
@echo "Waiting for services to spin up ..."
until timeout 5s ./etc/kube/check_ready.sh k8s-app=heapster kube-system; do sleep 5; done
until timeout 5s ./etc/kube/check_ready.sh k8s-app=influxdb kube-system; do sleep 5; done
until timeout 5s ./etc/kube/check_ready.sh k8s-app=grafana kube-system; do sleep 5; done
@echo "All services up. Now port forwarding grafana to localhost:3000"
kubectl --namespace=kube-system port-forward `kubectl --namespace=kube-system get pods -l k8s-app=grafana -o json | jq '.items[0].metadata.name' -r` 3000:3000 &
clean-launch-logging: check-kubectl check-kubectl-connection
git submodule update --init
cd etc/plugin/logging && ./undeploy.sh
launch-logging: check-kubectl check-kubectl-connection
@# Creates Fluentd / Elasticsearch / Kibana services for logging under --namespace=monitoring
git submodule update --init
cd etc/plugin/logging && ./deploy.sh
kubectl --namespace=monitoring port-forward `kubectl --namespace=monitoring get pods -l k8s-app=kibana-logging -o json | jq '.items[0].metadata.name' -r` 35601:5601 &
grep-data:
go run examples/grep/generate.go >examples/grep/set1.txt
go run examples/grep/generate.go >examples/grep/set2.txt
grep-example:
sh examples/grep/run.sh
logs: check-kubectl
kubectl $(KUBECTLFLAGS) get pod -l app=pachd | sed '1d' | cut -f1 -d ' ' | xargs -n 1 -I pod sh -c 'echo pod && kubectl $(KUBECTLFLAGS) logs pod'
follow-logs: check-kubectl
kubectl $(KUBECTLFLAGS) get pod -l app=pachd | sed '1d' | cut -f1 -d ' ' | xargs -n 1 -I pod sh -c 'echo pod && kubectl $(KUBECTLFLAGS) logs -f pod'
kubectl:
gcloud config set container/cluster $(CLUSTER_NAME)
gcloud container clusters get-credentials $(CLUSTER_NAME)
google-cluster-manifest:
@pachctl deploy --rethinkdb-cache-size=5G --dry-run google $(BUCKET_NAME) $(STORAGE_NAME) $(STORAGE_SIZE)
google-cluster:
gcloud container clusters create $(CLUSTER_NAME) --scopes storage-rw --machine-type $(CLUSTER_MACHINE_TYPE) --num-nodes $(CLUSTER_SIZE)
gcloud config set container/cluster $(CLUSTER_NAME)
gcloud container clusters get-credentials $(CLUSTER_NAME)
gcloud components install kubectl
-gcloud compute firewall-rules create pachd --allow=tcp:30650
gsutil mb gs://$(BUCKET_NAME) # for PFS
gcloud compute disks create --size=$(STORAGE_SIZE)GB $(STORAGE_NAME) # for PPS
clean-google-cluster:
gcloud container clusters delete $(CLUSTER_NAME)
gcloud compute firewall-rules delete pachd
gsutil -m rm -r gs://$(BUCKET_NAME)
gcloud compute disks delete $(STORAGE_NAME)
amazon-cluster-manifest: install
@pachctl deploy --dry-run amazon $(BUCKET_NAME) $(AWS_ID) $(AWS_KEY) $(AWS_TOKEN) $(AWS_REGION) $(STORAGE_NAME) $(STORAGE_SIZE)
amazon-cluster:
aws s3api create-bucket --bucket $(BUCKET_NAME) --region $(AWS_REGION)
aws ec2 create-volume --size $(STORAGE_SIZE) --region $(AWS_REGION) --availability-zone $(AWS_AVAILABILITY_ZONE) --volume-type gp2
amazon-clean-cluster:
aws s3api delete-bucket --bucket $(BUCKET_NAME) --region $(AWS_REGION)
aws ec2 detach-volume --force --volume-id $(STORAGE_NAME)
sleep 20
aws ec2 delete-volume --volume-id $(STORAGE_NAME)
amazon-clean-launch: clean-launch
kubectl $(KUBECTLFLAGS) delete --ignore-not-found secrets amazon-secret
kubectl $(KUBECTLFLAGS) delete --ignore-not-found persistentvolumes rethink-volume
kubectl $(KUBECTLFLAGS) delete --ignore-not-found persistentvolumeclaims rethink-volume-claim
amazon-clean:
@while :; \
do if echo "The following script will delete your AWS bucket and volume. The action cannot be undone. Do you want to proceed? (Y/n)";read REPLY; then \
case $$REPLY in Y|y) make amazon-clean-launch;make amazon-clean-cluster;break;; \
N|n) echo "The amazon clean process has been cancelled by user!";break;; \
*) echo "input parameter error, please input again ";continue;;esac; \
fi;done;
microsoft-cluster-manifest:
@pachctl deploy --dry-run microsoft $(CONTAINER_NAME) $(AZURE_STORAGE_NAME) $(AZURE_STORAGE_KEY) $(VHD_URI) $(STORAGE_SIZE)
microsoft-cluster:
azure group create --name $(AZURE_RESOURCE_GROUP) --location $(AZURE_LOCATION)
azure storage account create $(AZURE_STORAGE_NAME) --location $(AZURE_LOCATION) --resource-group $(AZURE_RESOURCE_GROUP) --sku-name LRS --kind Storage
clean-microsoft-cluster:
azure group delete $(AZURE_RESOURCE_GROUP) -q
install-go-bindata:
go get -u github.com/jteeuwen/go-bindata/...
lint:
etc/testing/lint.sh
spellcheck:
@mdspell doc/*.md doc/**/*.md *.md --en-us --ignore-numbers --ignore-acronyms --report --no-suggestions
goxc-generate-local:
@if [ -z $$GITHUB_OAUTH_TOKEN ]; then \
echo "Missing token. Please run via: 'make GITHUB_OAUTH_TOKEN=12345 goxc-generate-local'"; \
exit 1; \
fi
goxc -wlc default publish-github -apikey=$(GITHUB_OAUTH_TOKEN)
goxc-release:
@if [ -z $$VERSION ]; then \
@echo "Missing version. Please run via: 'make VERSION=v1.2.3-4567 VERSION_ADDITIONAL=4567 goxc-release'"; \
@exit 1; \
fi
sed 's/%%VERSION_ADDITIONAL%%/$(VERSION_ADDITIONAL)/' .goxc.json.template > .goxc.json
goxc -pv="$(VERSION)" -build-gcflags="$(GC_FLAGS)" -wd=./src/server/cmd/pachctl
goxc-build:
sed 's/%%VERSION_ADDITIONAL%%/$(VERSION_ADDITIONAL)/' .goxc.json.template > .goxc.json
goxc -build-gcflags="$(GC_FLAGS)" -tasks=xc -wd=./src/server/cmd/pachctl
.PHONY: all \
version \
deps \
update-deps \
build \
install \
install-clean \
install-doc \
homebrew \
release \
release-helper \
release-worker \
release-manifest \
release-pachctl-custom \
release-pachd \
release-version \
docker-build \
docker-build-compile \
docker-build-worker \
docker-build-pachd \
docker-build-proto \
docker-push-worker \
docker-push-pachd \
docker-push \
launch-kube \
clean-launch-kube \
kube-cluster-assets \
launch \
launch-dev \
clean-launch-dev \
clean-launch \
full-clean-launch \
clean-pps-storage \
integration-tests \
proto \
pretest \
test \
test-client \
test-s3gateway-conformance \
test-s3gateway-integration \
test-fuse \
test-local \
test-cli \
clean \
doc \
grep-data \
grep-example \
logs \
kubectl \
google-cluster-manifest \
google-cluster \
clean-google-cluster \
amazon-cluster-manifest \
amazon-cluster \
amazon-clean-cluster \
amazon-clean-launch \
amazon-clean \
install-go-bindata \
assets \
lint \
goxc-generate-local \
goxc-release \
goxc-build \
launch-test-rethinkdb \
clean-launch-test-rethinkdb