forked from vmware-archive/kubeless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
101 lines (72 loc) · 2.77 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
100
101
GO = go
GO_FLAGS =
GOFMT = gofmt
KUBECFG = kubecfg
DOCKER = docker
CONTROLLER_IMAGE = kubeless-function-controller:latest
FUNCTION_IMAGE_BUILDER = kubeless-function-image-builder: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
binary:
CGO_ENABLED=0 ./script/binary
binary-cross:
./script/binary-cli
%.yaml: %.jsonnet
$(KUBECFG) show -U https://raw.githubusercontent.com/kubeless/runtimes/master -o yaml $< > [email protected]
mv [email protected] $@
all-yaml: kubeless.yaml kubeless-non-rbac.yaml kubeless-openshift.yaml
kubeless.yaml: kubeless.jsonnet kubeless-non-rbac.jsonnet
kubeless-non-rbac.yaml: kubeless-non-rbac.jsonnet
kubeless-openshift.yaml: kubeless-openshift.jsonnet
docker/function-controller: controller-build
cp $(BUNDLES)/kubeless_$(OS)-$(ARCH)/kubeless-function-controller $@
controller-build:
./script/binary-controller -os=$(OS) -arch=$(ARCH)
function-controller: docker/function-controller
$(DOCKER) build -t $(CONTROLLER_IMAGE) $<
docker/function-image-builder: function-image-builder-build
cp $(BUNDLES)/kubeless_$(OS)-$(ARCH)/imbuilder $@
function-image-builder-build:
./script/binary-controller -os=$(OS) -arch=$(ARCH) imbuilder github.com/kubeless/kubeless/pkg/function-image-builder
function-image-builder: docker/function-image-builder
$(DOCKER) build -t $(FUNCTION_IMAGE_BUILDER) $<
update:
./hack/update-codegen.sh
test:
$(GO) test $(GO_FLAGS) $(GO_PACKAGES)
validation:
./script/validate-lint
./script/validate-gofmt
./script/validate-git-marks
integration-tests:
./script/integration-tests minikube deployment
./script/integration-tests minikube basic
fmt:
$(GOFMT) -s -w $(GO_FILES)
bats:
git clone --branch=v0.4.0 --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
GO111MODULE="off" go get -u github.com/mitchellh/gox
GO111MODULE="off" go get -u golang.org/x/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