-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
89 lines (69 loc) · 3.02 KB
/
Makefile
File metadata and controls
89 lines (69 loc) · 3.02 KB
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
CURRENT_DIR=$(shell pwd)
DIST_DIR=${CURRENT_DIR}/dist
E2E_CLUSTER_NAME=gatewayapi-plugin-e2e
IS_E2E_CLUSTER=$(shell kind get clusters | grep -e "^${E2E_CLUSTER_NAME}$$")
CHAINSAW_VERSION=v0.2.12
# Versions of components used in e2e tests
GATEWAY_API_VERSION=v1.4.0
# See more versions at https://artifacthub.io/packages/helm/argo/argo-rollouts
ARGO_ROLLOUTS_HELM_VERSION=2.40.5 # Contains Argo Rollouts 1.8.3
# See more versions at https://artifacthub.io/packages/helm/traefik/traefik
TRAEFIK_HELM_VERSION=37.4.0 # Contains Traefik proxy v3.6.2
CLUSTER_DELETE ?= true
define add_helm_repo
helm repo add traefik https://traefik.github.io/charts
helm repo add argo https://argoproj.github.io/argo-helm
endef
define setup_cluster
helm install argo-rollouts argo/argo-rollouts --values ./test/cluster-setup/argo-rollouts-values.yml --version ${ARGO_ROLLOUTS_HELM_VERSION} --wait
helm install traefik traefik/traefik --values ./test/cluster-setup/traefik-values.yml --version ${TRAEFIK_HELM_VERSION} --wait
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/${GATEWAY_API_VERSION}/experimental-install.yaml --server-side=true --force-conflicts
endef
.PHONY: install-dependencies
install-dependencies:
go mod download
.PHONY: release
release:
make BIN_NAME=gatewayapi-plugin-darwin-amd64 GOOS=darwin GOARCH=amd64 gatewayapi-plugin-build
make BIN_NAME=gatewayapi-plugin-darwin-arm64 GOOS=darwin GOARCH=arm64 gatewayapi-plugin-build
make BIN_NAME=gatewayapi-plugin-linux-amd64 GOOS=linux GOARCH=amd64 gatewayapi-plugin-build
make BIN_NAME=gatewayapi-plugin-linux-arm64 GOOS=linux GOARCH=arm64 gatewayapi-plugin-build
make BIN_NAME=gatewayapi-plugin-windows-amd64.exe GOOS=windows gatewayapi-plugin-build
.PHONY: gatewayapi-plugin-build
gatewayapi-plugin-build:
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go build -v -o ${DIST_DIR}/${BIN_NAME} .
.PHONY: local-build
local-build:
go build -gcflags=all="-N -l" -o gatewayapi-plugin
.PHONY: lint
lint:
golangci-lint run --fix
.PHONY: unit-tests
unit-tests:
go test -v -count=1 ./pkg/...
.PHONY: setup-e2e-cluster
setup-e2e-cluster:
make BIN_NAME=gatewayapi-plugin-linux-amd64 GOOS=linux GOARCH=amd64 gatewayapi-plugin-build
ifeq (${IS_E2E_CLUSTER},)
kind create cluster --name ${E2E_CLUSTER_NAME} --config ./test/cluster-setup/cluster-config.yml
$(call add_helm_repo)
$(call setup_cluster)
endif
.PHONY: sanity-check-e2e
sanity-check-e2e:
./test/cluster-setup/sanity-check.sh
.PHONY: clear-e2e-cluster
clear-e2e-cluster:
kind delete cluster --name ${E2E_CLUSTER_NAME}
.PHONY: run-e2e-tests
run-e2e-tests: sanity-check-e2e
chainsaw test --report-format JUNIT-TEST --report-name chainsaw-report --report-path . ./test/e2e/chainsaw
.PHONY: e2e-tests
e2e-tests: setup-e2e-cluster run-e2e-tests
ifeq (${CLUSTER_DELETE},true)
make clear-e2e-cluster
endif
# convenience target to run `mkdocs serve` using a docker container
.PHONY: serve-docs
serve-docs: ## serve docs locally
docker run --rm -it -p 8000:8000 -v ${CURRENT_DIR}:/docs squidfunk/mkdocs-material serve -a 0.0.0.0:8000