forked from box/kube-applier
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
59 lines (49 loc) · 2.1 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
SHELL := /bin/bash
IMAGE := quay.io/utilitywarehouse/kube-applier
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
.PHONY: manifests generate controller-gen-install test build run release
# Generate manifests e.g. CRD, RBAC etc.
manifests: controller-gen-install
controller-gen \
crd:crdVersions=v1 \
paths="./..." \
output:crd:artifacts:config=manifests/base/cluster
@{ \
cd manifests/base/cluster ;\
kustomize edit add resource kube-applier.io_* ;\
}
# Generate code
generate: controller-gen-install
controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
# Make sure controller-gen is installed. This should build and install packages
# in module-aware mode, ignoring any local go.mod file
controller-gen-install:
go install sigs.k8s.io/controller-tools/cmd/[email protected]
KUBEBUILDER_BINDIR=$${PWD}/kubebuilder-bindir
KUBEBUILDER_VERSION="1.30.x"
test:
command -v setup-envtest || go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
mkdir -p $(KUBEBUILDER_BINDIR)
setup-envtest --bin-dir $(KUBEBUILDER_BINDIR) use -p env $(KUBEBUILDER_VERSION)
source <(setup-envtest --bin-dir $(KUBEBUILDER_BINDIR) use -i -p env $(KUBEBUILDER_VERSION)); CGO_ENABLED=1; go test -v -race -count=1 -cover ./...
build:
docker build -t kube-applier .
BJS_VERSION="5.1.0"
update-bootstrap-js:
(cd /tmp/ && curl -L -O https://github.com/twbs/bootstrap/releases/download/v$(BJS_VERSION)/bootstrap-$(BJS_VERSION)-dist.zip)
(cd /tmp/ && unzip bootstrap-$(BJS_VERSION)-dist.zip)
cp /tmp/bootstrap-$(BJS_VERSION)-dist/js/bootstrap.js static/bootstrap/js/bootstrap.js
update-jquery-js:
curl -o static/bootstrap/js/jquery.min.js https://code.jquery.com/jquery-3.6.0.min.js
release:
@sd "$(IMAGE):master" "$(IMAGE):$(VERSION)" $$(rg -l -- $(IMAGE) manifests/)
@git add -- manifests/
@git commit -m "Release $(VERSION)"
@sd "$(IMAGE):$(VERSION)" "$(IMAGE):master" $$(rg -l -- "$(IMAGE)" manifests/)
@git add -- manifests/
@git commit -m "Clean up release $(VERSION)"