-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
103 lines (75 loc) · 2.57 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
.DEFAULT_GOAL:=help
SHELL:=/usr/bin/env bash
COLOR:=\\033[36m
NOCOLOR:=\\033[0m
.PHONY: test build docker-build docker-push sonobuoy-run sonobuoy-retrieve
REGISTRY?=yzaccc
IMAGE?=k8s-service-validator
TAG?=dev
##@ Build
test: ## Runs tests locally
go test -v ./tests --skip-labels "type=iperf"
test-perf: ## Runs full iperf test and generate bandwidth matrix on all the nodes
go test -v ./tests --labels "type=iperf"
unit-test: ## Runs unit test for the service-lb validator
go test -v ./pkg/entities
go test -v ./pkg/commands
go test -v ./pkg/matrix
summary: ## Summarize tests
gotestsum --format testname --hide-summary=skipped -- ./tests/... $(SUMMARY_OPTIONS)
build: ## Build tests in a binary
go test -v -c -o svc-test ./tests
docker-build: ## Build project into docker container image
docker build . -t ${REGISTRY}/${IMAGE}:${TAG}
docker-push: ## Push the project docker image to dockerhub
docker push ${REGISTRY}/${IMAGE}:${TAG}
sonobuoy-run: ## Run k8s-service-validator as sonobuoy plugin in a cluster
sonobuoy delete
sonobuoy run --plugin sonobuoy-plugin.yaml --wait
sonobuoy-retrieve: ## Retrieve results from sonobuoy plugin
rm -rf results
$(eval OUTFILE=$(shell sonobuoy retrieve))
echo $(OUTFILE)
mkdir results && tar -xf $(OUTFILE) -C results
cat results/plugins/k8s-service-validator-sonobuoy-plugin/*.yaml
clean: ## Clean up sonobuoy results and output binary
rm -rf results *_sonobuoy_* svc-test
report:
go run ./cmd/report/main.go
##@ Verify
.PHONY: verify verify-golangci-lint verify-go-mod
verify: verify-golangci-lint verify-go-mod ## Runs verification scripts to ensure correct execution
verify-go-mod: ## Runs the go module linter
./hack/verify-go-mod.sh
verify-golangci-lint: ## Runs all golang linters
./hack/verify-golangci-lint.sh
##@ Dependencies
.SILENT: update-deps update-deps-go
.PHONY: update-deps update-deps-go
update-deps: update-deps-go ## Update all dependencies for this repo
echo -e "${COLOR}Commit/PR the following changes:${NOCOLOR}"
git status --short
update-deps-go: GO111MODULE=on
update-deps-go: ## Update all golang dependencies for this repo
go get -u -t ./...
go mod tidy
go mod verify
$(MAKE) test-go-unit
./hack/update-all.sh
##@ Helpers
.PHONY: help
help: ## Display this help
@awk \
-v "col=${COLOR}" -v "nocol=${NOCOLOR}" \
' \
BEGIN { \
FS = ":.*##" ; \
printf "\nUsage:\n make %s<target>%s\n", col, nocol \
} \
/^[a-zA-Z_-]+:.*?##/ { \
printf " %s%-15s%s %s\n", col, $$1, nocol, $$2 \
} \
/^##@/ { \
printf "\n%s%s%s\n", col, substr($$0, 5), nocol \
} \
' $(MAKEFILE_LIST)