-
Notifications
You must be signed in to change notification settings - Fork 243
/
Copy pathMakefile
89 lines (71 loc) · 2.54 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
##### Global variables #####
include version.mk Makefile.defs
all: build
docker:
docker build \
--build-arg GOLANG_IMAGE=${GOLANG_IMAGE} \
--build-arg TARGET_ARCH=${TARGET_ARCH} \
--build-arg NVIDIA_IMAGE=${NVIDIA_IMAGE} \
--build-arg DEST_DIR=${DEST_DIR} \
--build-arg VERSION=${VERSION} \
--build-arg GOPROXY=https://goproxy.cn,direct \
. -f=docker/Dockerfile -t ${IMG_TAG}
dockerwithlib:
docker build \
--no-cache \
--build-arg GOLANG_IMAGE=${GOLANG_IMAGE} \
--build-arg TARGET_ARCH=${TARGET_ARCH} \
--build-arg NVIDIA_IMAGE=${NVIDIA_IMAGE} \
--build-arg DEST_DIR=${DEST_DIR} \
--build-arg VERSION=${VERSION} \
--build-arg GOPROXY=https://goproxy.cn,direct \
. -f=docker/Dockerfile.withlib -t ${IMG_TAG}
tidy:
$(GO) mod tidy
proto:
$(GO) get github.com/gogo/protobuf/protoc-gen-gofast@v1.3.2
protoc --gofast_out=plugins=grpc:. ./pkg/api/*.proto
build: $(CMDS) $(DEVICES)
$(CMDS):
$(GO) build -ldflags '-s -w -X github.com/Project-HAMi/HAMi/pkg/version.version=$(VERSION)' -o ${OUTPUT_DIR}/$@ ./cmd/$@
$(DEVICES):
$(GO) build -ldflags '-s -w -X github.com/Project-HAMi/HAMi/pkg/device-plugin/nvidiadevice/nvinternal/info.version=$(VERSION)' -o ${OUTPUT_DIR}/$@-device-plugin ./cmd/device-plugin/$@
clean:
$(GO) clean -r -x ./cmd/...
-rm -rf $(OUTPUT_DIR)
.PHONY: all build docker clean $(CMDS)
test:
mkdir -p ./_output/coverage/
bash hack/unit-test.sh
lint:
bash hack/verify-staticcheck.sh
.PHONY: verify
verify:
hack/verify-all.sh
.PHONY: lint_dockerfile
lint_dockerfile:
@ docker run --rm \
-v $(ROOT_DIR)/.trivyignore:/.trivyignore \
-v /tmp/trivy:/root/trivy.cache/ \
-v $(ROOT_DIR):/tmp/src \
aquasec/trivy:$(TRIVY_VERSION) config --exit-code 1 --severity $(LINT_TRIVY_SEVERITY_LEVEL) /tmp/src/docker ; \
(($$?==0)) || { echo "error, failed to check dockerfile trivy" && exit 1 ; } ; \
echo "dockerfile trivy check: pass"
.PHONY: lint_chart
lint_chart:
@ docker run --rm \
-v $(ROOT_DIR)/.trivyignore:/.trivyignore \
-v /tmp/trivy:/root/trivy.cache/ \
-v $(ROOT_DIR):/tmp/src \
aquasec/trivy:$(TRIVY_VERSION) config --exit-code 1 --severity $(LINT_TRIVY_SEVERITY_LEVEL) /tmp/src/charts ; \
(($$?==0)) || { echo "error, failed to check chart trivy" && exit 1 ; } ; \
echo "chart trivy check: pass"
.PHONY: e2e-env-setup
e2e-env-setup:
./hack/e2e-test-setup.sh
.PHONY: helm-deploy
helm-deploy:
./hack/deploy-helm.sh "${E2E_TYPE}" "${KUBE_CONF}" "${HAMI_VERSION}"
.PHONY: e2e-test
e2e-test:
./hack/e2e-test.sh "${E2E_TYPE}" "${KUBE_CONF}"