-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (58 loc) · 1.61 KB
/
Makefile
File metadata and controls
74 lines (58 loc) · 1.61 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
now := $(shell date)
PREFIX ?= zeusro
APP_NAME ?= kube-killer:latest
IMAGE ?= $(PREFIX)/$(APP_NAME)
MIRROR_IMAGE ?= registry.cn-shenzhen.aliyuncs.com/
ARCH ?=amd64
auto_commit:
git add .
git commit -am "$(now)"
git pull
git push
build:
GOARCH=$(ARCH) CGO_ENABLED=0 go build
build-kubectl-plugin:
GOARCH=$(ARCH) CGO_ENABLED=0 go build -o kubectl-kill ./cmd/kubectl-kill
buildAndRun: build run
fix-dep:
go mod tidy
go mod vendor
# usage dep="github.com/stretchr/testify/assert" make get
get:
go get -u -v $(dep)
go mod tidy
go mod vendor
mirror: pull
docker build -t $(MIRROR_IMAGE) -f deploy/docker/Dockerfile .
pull:
git reset --hard HEAD
git pull
release-mirror: mirror
docker push $(MIRROR_IMAGE)
rebuild: pull
docker build -t $(IMAGE) -f deploy/docker/Dockerfile .
run:
./kube-killer
test:
mkdir -p artifacts/report/coverage
go test -v -cover -coverprofile c.out.tmp ./...
cat c.out.tmp | grep -v "_mock.go" > c.out
go tool cover -html=c.out -o artifacts/report/coverage/index.html
up:
docker-compose build --force-rm --no-cache
docker-compose up
update-dep: update-mod fix-dep
update-mod:
go get -u -v github.com/p-program/go-common-library
# go-mod-upgrade
# Install kubectl-kill plugin to ~/bin or /usr/local/bin
# Usage: make install-kubectl-plugin [PREFIX=/usr/local]
install-kubectl-plugin: build-kubectl-plugin
@if [ -z "$(PREFIX)" ]; then \
PREFIX=$$HOME/bin; \
fi; \
mkdir -p $$PREFIX; \
cp kubectl-kill $$PREFIX/; \
chmod +x $$PREFIX/kubectl-kill; \
echo "kubectl-kill plugin installed to $$PREFIX/kubectl-kill"; \
echo "Make sure $$PREFIX is in your PATH"