This repository has been archived by the owner on Dec 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathMakefile
78 lines (57 loc) · 1.99 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
GO = go
GO_FLAGS =
GOFMT = gofmt
KUBECFG = kubecfg
DOCKER = docker
NATS_CONTROLLER_IMAGE = nats-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
default: binary
binary:
CGO_ENABLED=1 ./script/binary
%.yaml: %.jsonnet
$(KUBECFG) show -o yaml $< > $@.tmp
mv $@.tmp $@
all-yaml: nats.yaml
nats.yaml: nats.jsonnet
nats-controller-build:
./script/binary-controller -os=$(OS) -arch=$(ARCH) nats-controller github.com/kubeless/nats-trigger/cmd/nats-trigger-controller
nats-controller-image: docker/nats-controller
$(DOCKER) build -t $(NATS_CONTROLLER_IMAGE) $<
docker/nats-controller: nats-controller-build
cp $(BUNDLES)/kubeless_$(OS)-$(ARCH)/nats-controller $@
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 --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
@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