-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (53 loc) · 1.75 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
.EXPORT_ALL_VARIABLES:
BIN_DIR := ./bin
OUT_DIR := ./output
$(shell mkdir -p $(BIN_DIR) $(OUT_DIR))
IMAGE_REGISTRY=zufardhiyaulhaq
IMAGE_NAME=$(IMAGE_REGISTRY)/kubernetesweekly
IMAGE_TAG=$(shell git rev-parse --short HEAD)
CURRENT_DIR=$(shell pwd)
VERSION=$(shell cat ${CURRENT_DIR}/VERSION)
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
GIT_COMMIT=$(shell git rev-parse --short HEAD)
GIT_TREE_STATE=$(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi)
STATIC_BUILD?=true
override LDFLAGS += \
-X ${PACKAGE}.version=${VERSION} \
-X ${PACKAGE}.buildDate=${BUILD_DATE} \
-X ${PACKAGE}.gitCommit=${GIT_COMMIT} \
-X ${PACKAGE}.gitTreeState=${GIT_TREE_STATE}
ifeq (${STATIC_BUILD}, true)
override LDFLAGS += -extldflags "-static"
endif
ifneq (${GIT_TAG},)
IMAGE_TAG=${GIT_TAG}
IMAGE_TRACK=stable
LDFLAGS += -X ${PACKAGE}.gitTag=${GIT_TAG}
else
IMAGE_TAG?=$(GIT_COMMIT)
IMAGE_TRACK=latest
endif
.PHONY: test
test:
go get golang.org/x/tools/cmd/cover
go test -coverprofile=./output/coverage.out -race ./...
go tool cover -html=./output/coverage.out -o ./output/coverage.html
.PHONY: lint
lint:
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.41.1
golangci-lint run --verbose
.PHONY: build
build:
CGO_ENABLED=0 GO111MODULE=on go build -a -ldflags '${LDFLAGS}' -o ${BIN_DIR}/kubernetesweekly ./cmd/kubernetesweekly/main.go
.PHONY: run
run:
go run cmd/kubernetesweekly/main.go
.PHONY: readme
readme:
GO111MODULE=on go get github.com/norwoodj/helm-docs/cmd/helm-docs
helm-docs -c ./charts/kubernetesweekly -d > README.md
helm-docs -c ./charts/kubernetesweekly
.PHONY: helm.create.releases
helm.create.releases:
helm package charts/kubernetesweekly --destination charts/releases
helm repo index charts/releases