forked from vmware-archive/kafka-trigger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
99 lines (72 loc) · 2.53 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
94
95
96
97
98
99
GO = go
GO_FLAGS =
GOFMT = gofmt
KUBECFG = kubecfg
DOCKER = docker
CONTROLLER_IMAGE = kubeless-controller-manager:latest
KAFKA_CONTROLLER_IMAGE = kafka-trigger-controller:latest
OS = linux
ARCH = amd64
BUNDLES = bundles
GO_PACKAGES = ./cmd/... ./pkg/...
GO_FILES := $(shell find $(shell $(GO) list -f '{{.Dir}}' $(GO_PACKAGES)) -name \*.go)
export KUBECFG_JPATH := $(CURDIR)/ksonnet-lib
export PATH := $(PATH):$(CURDIR)/bats/bin
.PHONY: all
KUBELESS_ENVS := \
-e OS_PLATFORM_ARG \
-e OS_ARCH_ARG \
default: binary
all:
CGO_ENABLED=1 ./script/make.sh
binary:
CGO_ENABLED=1 ./script/binary
binary-cross:
./script/binary-cli
%.yaml: %.jsonnet
$(KUBECFG) show -o yaml $< > [email protected]
mv [email protected] $@
all-yaml: kafka-zookeeper.yaml kafka-zookeeper-openshift.yaml
kafka-zookeeper.yaml: kafka-zookeeper.jsonnet
kafka-zookeeper-openshift.yaml: kafka-zookeeper-openshift.jsonnet
docker/kafka-controller: kafka-controller-build
cp $(BUNDLES)/kubeless_$(OS)-$(ARCH)/kafka-controller $@
kafka-controller-build:
./script/kafka-controller.sh -os=$(OS) -arch=$(ARCH)
kafka-controller-image: docker/kafka-controller
$(DOCKER) build -t $(KAFKA_CONTROLLER_IMAGE) $<
update:
./hack/update-codegen.sh
test:
$(GO) test $(GO_FLAGS) $(GO_PACKAGES)
validation:
./script/validate-vet
./script/validate-lint
./script/validate-gofmt
./script/validate-git-marks
integration-tests:
./script/integration-tests minikube deployment
./script/integration-tests minikube basic
minikube-rbac-test:
./script/integration-test-rbac minikube
fmt:
$(GOFMT) -s -w $(GO_FILES)
bats:
git clone --depth=1 https://github.com/sstephenson/bats.git
ksonnet-lib:
git clone --depth=1 https://github.com/ksonnet/ksonnet-lib.git
.PHONY: bootstrap
bootstrap: bats ksonnet-lib
go get github.com/mitchellh/gox
go get github.com/golang/lint/golint
@if ! which kubecfg >/dev/null; then \
sudo wget -q -O /usr/local/bin/kubecfg https://github.com/ksonnet/kubecfg/releases/download/v0.9.0/kubecfg-$$(go env GOOS)-$$(go env GOARCH); \
sudo chmod +x /usr/local/bin/kubecfg; \
fi
@if ! which kubectl >/dev/null; then \
KUBECTL_VERSION=$$(wget -qO- https://storage.googleapis.com/kubernetes-release/release/stable.txt); \
sudo wget -q -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$$KUBECTL_VERSION/bin/$$(go env GOOS)/$$(go env GOARCH)/kubectl; \
sudo chmod +x /usr/local/bin/kubectl; \
fi
build_and_test:
./script/start-test-environment.sh "make binary && make controller-image CONTROLLER_IMAGE=bitnami/kubeless-controller-manager:latest && make integration-tests"