forked from derailed/k9s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
33 lines (26 loc) · 1.11 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
GO_FLAGS ?=
NAME := k9s
OUTPUT_BIN ?= execs/${NAME}
PACKAGE := github.com/derailed/$(NAME)
GIT_REV ?= $(shell git rev-parse --short HEAD)
SOURCE_DATE_EPOCH ?= $(shell date +%s)
DATE ?= $(shell date -u -d @${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:%M:%SZ")
VERSION ?= v0.26.3
IMG_NAME := derailed/k9s
IMAGE := ${IMG_NAME}:${VERSION}
default: help
test: ## Run all tests
@go clean --testcache && go test ./...
cover: ## Run test coverage suite
@go test ./... --coverprofile=cov.out
@go tool cover --html=cov.out
build: ## Builds the CLI
@go build ${GO_FLAGS} \
-ldflags "-w -s -X ${PACKAGE}/cmd.version=${VERSION} -X ${PACKAGE}/cmd.commit=${GIT_REV} -X ${PACKAGE}/cmd.date=${DATE}" \
-a -tags netgo -o ${OUTPUT_BIN} main.go
kubectl-stable-version: ## Get kubectl latest stable version
@curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt
img: ## Build Docker Image
@docker build --rm -t ${IMAGE} .
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":[^:]*?## "}; {printf "\033[38;5;69m%-30s\033[38;5;38m %s\033[0m\n", $$1, $$2}'