-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (56 loc) · 1.9 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
# The binary to build (just the basename).
BIN := $(shell basename $$PWD)
COMMIT := $(shell git describe --dirty --always)
TAG := $(shell git describe --tags --dirty || echo latest)
LDFLAGS := "-s -w -X github.com/coredns/coredns/coremain.GitCommit=$(COMMIT)"
ARCHS := "linux/amd64,linux/arm64,linux/mips64"
# Where to push the docker image.
REGISTRY ?= ghcr.io/pinax-network
# Image URL to use all building/pushing image targets
IMG ?= $(REGISTRY)/$(BIN)
setup:
./test/kind-with-registry.sh
up:
tilt up
down:
tilt down
nuke:
./test/teardown-kind-with-registry.sh
## Build the plugin binary
build:
CGO_ENABLED=0 go build -ldflags $(LDFLAGS) cmd/coredns.go
## Generate new helm package and update chart yaml file
helm-update:
helm package charts/k8s-gateway -d charts.tmp/charts
helm repo index --url https://ori-edge.github.io/k8s_gateway/ --merge index.yaml charts.tmp/
mv charts.tmp/charts/* charts/
mv charts.tmp/index.yaml .
rmdir charts.tmp/charts
rmdir charts.tmp
.PHONY: test
test:
go test -race ./... -short
.PHONY: ci
ci:
golangci-lint run --timeout=5m0s
clean:
go clean
rm -f coredns
## Build the docker image
docker: test
docker buildx build --push \
--build-arg LDFLAGS=$(LDFLAGS) \
--platform ${ARCHS} \
-t ${IMG}:${COMMIT} \
.
## Release the current code with git tag and `latest`
release: test
docker buildx build --push \
--build-arg LDFLAGS=$(LDFLAGS) \
--platform ${ARCHS} \
-t ${IMG}:${TAG} \
-t ${IMG}:latest \
.
# From: https://gist.github.com/klmr/575726c7e05d8780505a
help:
@echo "$$(tput sgr0)";sed -ne"/^## /{h;s/.*//;:d" -e"H;n;s/^## //;td" -e"s/:.*//;G;s/\\n## /---/;s/\\n/ /g;p;}" ${MAKEFILE_LIST}|awk -F --- -v n=$$(tput cols) -v i=15 -v a="$$(tput setaf 6)" -v z="$$(tput sgr0)" '{printf"%s%*s%s ",a,-i,$$1,z;m=split($$2,w," ");l=n-i;for(j=1;j<=m;j++){l-=length(w[j])+1;if(l<= 0){l=n-i-length(w[j])-1;printf"\n%*s ",-i," ";}printf"%s ",w[j];}printf"\n";}'