forked from kubernetes-sigs/custom-metrics-apiserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (28 loc) · 975 Bytes
/
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
REGISTRY?=kubernetes-sigs
IMAGE?=k8s-test-metrics-adapter
TEMP_DIR:=$(shell mktemp -d)
ARCH?=amd64
OUT_DIR?=./_output
VERSION?=latest
.PHONY: all build-test-adapter test verify-gofmt gofmt verify test-adapter-container
all: build-test-adapter
build-test-adapter: vendor
CGO_ENABLED=0 GOARCH=$(ARCH) go build -o $(OUT_DIR)/$(ARCH)/test-adapter github.com/kubernetes-sigs/custom-metrics-apiserver/test-adapter
vendor: tidy
go mod vendor
tidy:
go mod tidy
test:
CGO_ENABLED=0 go test ./pkg/...
verify-gofmt:
./hack/gofmt-all.sh -v
gofmt:
./hack/gofmt-all.sh
verify: verify-gofmt test
test-adapter-container: build-test-adapter
cp test-adapter-deploy/Dockerfile $(TEMP_DIR)
cp $(OUT_DIR)/$(ARCH)/test-adapter $(TEMP_DIR)/adapter
cd $(TEMP_DIR) && sed -i "s|BASEIMAGE|scratch|g" Dockerfile
sed -i 's|REGISTRY|'${REGISTRY}'|g' test-adapter-deploy/testing-adapter.yaml
docker build -t $(REGISTRY)/$(IMAGE)-$(ARCH):$(VERSION) $(TEMP_DIR)
rm -rf $(TEMP_DIR)