forked from manifoldco/kubernetes-credentials
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
93 lines (69 loc) · 2.21 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
LINTERS=\
gofmt \
golint \
gosimple \
vet \
misspell \
ineffassign \
deadcode
ci: $(LINTERS) test
.PHONY: ci
#################################################
# Bootstrapping for base golang package deps
#################################################
BOOTSTRAP=\
github.com/golang/dep/cmd/dep \
github.com/alecthomas/gometalinter
$(BOOTSTRAP):
go get -u $@
bootstrap: $(BOOTSTRAP)
gometalinter --install
vendor: Gopkg.lock
dep ensure -v -vendor-only
.PHONY: bootstrap $(BOOTSTRAP)
#################################################
# Building
#################################################
deepcopy-gen:
go get -u k8s.io/code-generator/cmd/deepcopy-gen
generated: primitives/zz_generated.go
primitives/zz_generated.go: deepcopy-gen $(wildcard primitives,*.go)
deepcopy-gen -v=5 -h boilerplate.go.txt -i github.com/manifoldco/kubernetes-credentials/primitives -O zz_generated
bin/controller: vendor primitives/zz_generated.go
CGO_ENABLED=0 GOOS=linux go build -a -o bin/controller .
docker-dev: bin/controller
docker build -f Dockerfile.dev -t manifoldco/kubernetes-credentials .
docker:
docker build -t manifoldco/kubernetes-credentials .
.PHONY: generated
#################################################
# Test and linting
#################################################
test: vendor
@CGO_ENABLED=0 go test -v ./...
lint: $(LINTERS)
METALINT=gometalinter --tests --disable-all --vendor --deadline=5m -e "zz_.*\.go" \
./... --enable
$(LINTERS): vendor
$(METALINT) $@
.PHONY: $(LINTERS) test lint
#################################################
# Releasing
#################################################
release:
ifneq ($(shell git rev-parse --abbrev-ref HEAD),master)
$(error You are not on the master branch)
endif
ifneq ($(shell git status --porcelain),)
$(error You have uncommitted changes on your branch)
endif
ifndef VERSION
$(error You need to specify the version you want to tag)
endif
sed -i -e 's|Version = ".*"|Version = "$(VERSION)"|' version.go
sed -i -e 's|kubernetes-credentials:v.*|kubernetes-credentials:v$(VERSION)|' credentials-controller.yml
git add version.go credentials-controller.yml
git commit -m "Tagging v$(VERSION)"
git tag v$(VERSION)
git push
git push --tags