forked from kubermatic/machine-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (54 loc) · 1.82 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
SHELL = /bin/bash
GO_VERSION = 1.10.1
export CGO_ENABLED := 0
REGISTRY ?= docker.io
REGISTRY_NAMESPACE ?= kubermatic
IMAGE_TAG = \
$(shell echo $$(git rev-parse HEAD && if [[ -n $$(git status --porcelain) ]]; then echo '-dirty'; fi)|tr -d ' ')
IMAGE_NAME = $(REGISTRY)/$(REGISTRY_NAMESPACE)/machine-controller:$(IMAGE_TAG)
vendor: Gopkg.lock Gopkg.toml
dep ensure -vendor-only
machine-controller-docker:
@docker run --rm \
-v $$PWD:/go/src/github.com/kubermatic/machine-controller \
-v $$PWD/.buildcache:/cache \
-e GOCACHE=/cache \
-w /go/src/github.com/kubermatic/machine-controller \
golang:$(GO_VERSION) \
make machine-controller
machine-controller: $(shell find cmd pkg -name '*.go') vendor
go build \
-ldflags '-s -w' \
-o machine-controller \
github.com/kubermatic/machine-controller/cmd/controller
docker-image: machine-controller
make docker-image-nodep
# This target exists because in our CI
# we do not want to restore the vendor
# folder for the push step, but we know
# for sure it is not required there
docker-image-nodep:
docker build -t $(IMAGE_NAME) .
docker push $(IMAGE_NAME)
if [[ -n "$(GIT_TAG)" ]]; then \
$(eval IMAGE_TAG = $(GIT_TAG)) \
docker build -t $(IMAGE_NAME) . && \
docker push $(IMAGE_NAME) && \
$(eval IMAGE_TAG = latest) \
docker build -t $(IMAGE_NAME) . ;\
docker push $(IMAGE_NAME) ;\
fi
test-unit-docker:
@docker run --rm \
-v $$PWD:/go/src/github.com/kubermatic/machine-controller \
-v $$PWD/.buildcache:/cache \
-e GOCACHE=/cache \
-w /go/src/github.com/kubermatic/machine-controller \
golang:$(GO_VERSION) \
make test-unit
test-unit: vendor
@#The `-race` flag requires CGO
CGO_ENABLED=1 go test -race ./...
e2e-cluster:
make -C test/tools/integration apply
./test/tools/integration/provision_master.sh do-not-deploy-machine-controller