This repository has been archived by the owner on Apr 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
123 lines (96 loc) · 2.9 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
BUF ?= buf
VALIDATE_VERSION ?= v1.0.2
BUILD_DIR := .build/
.DEFAULT: run-server
all: gen-proto
# Build, Format, etc., Tools, Dependency checkouts
buf:
ifeq (, $(shell which buf))
go install github.com/bufbuild/buf/cmd/buf@v1.26.1
endif
protoc-gen-validate: build_dir
if test ! -d $(BUILD_DIR)validate-$(VALIDATE_VERSION)/; then \
git clone --branch $(VALIDATE_VERSION) https://github.com/bufbuild/protoc-gen-validate.git $(BUILD_DIR)validate-$(VALIDATE_VERSION); \
else \
git -C $(BUILD_DIR)validate-$(VALIDATE_VERSION)/ pull --all; \
git -C $(BUILD_DIR)validate-$(VALIDATE_VERSION)/ checkout $(VALIDATE_VERSION); \
fi
cd $(BUILD_DIR) && ln -sfn validate-$(VALIDATE_VERSION)/ validate
# ====================================================================================
# Makefile helper functions for helm-docs: https://github.com/norwoodj/helm-docs
#
HELM_DOCS_VERSION := v1.11.0
HELM_DOCS := helm-docs
HELM_DOCS_REPO := github.com/norwoodj/helm-docs/cmd/helm-docs
bin-$(HELM_DOCS): ## Installs helm-docs
@GO111MODULE=on go install $(HELM_DOCS_REPO)@$(HELM_DOCS_VERSION)
build_dir:
mkdir -p $(BUILD_DIR)
.PHONY: clean
clean:
@npx nuxi cleanup
rm -rf ./.nuxt/dist/
.PHONY: watch
watch:
yarn dev
.PHONY: gen-proto
gen-proto: protoc-gen-validate
$(BUF) generate
.PHONY: build-container
build-container: build-yarn
docker build \
--force-rm=true\
-t docker.io/koorinc/data-control-center:latest .
.PHONY: release
release:
docker tag docker.io/koorinc/data-control-center:latest docker.io/koorinc/data-control-center:$(TAG)
.PHONY: build-go
build-go:
CGO_ENABLED=0 go \
build \
-a \
-installsuffix cgo \
-ldflags "-X github.com/koor-tech/data-control-center/pkg/version.Version=$(shell git describe --tags --exclude='data-control-center-*')" \
-o data-control-center .
.PHONY: build-yarn
build-yarn:
rm -rf ./.nuxt/dist/
yarn build
yarn generate
.PHONY: run-cephapidummy
run-cephapidummy:
npx ts-node-esm ./node/server.ts
.PHONY: run-server
run-server:
mkdir -p ./.nuxt/dist/
go run . server
.PHONY: fmt
fmt:
$(MAKE) fmt-proto gen-proto
$(MAKE) fmt-js
.PHONY: fmt-proto
fmt-proto: buf
$(BUF) format --write ./api
.PHONY: fmt-js
fmt-js:
yarn prettier --write ./src
.PHONY: gen-licenses
gen-licenses:
yarn licenses generate-disclaimer > ./src/public/licenses/frontend.txt
go-licenses report . --template internal/scripts/licenses-backend.txt.tpl > ./src/public/licenses/backend.txt
.PHONY: helm-docs
helm-docs: bin-$(HELM_DOCS) ## Use helm-docs to generate documentation from helm charts
$(HELM_DOCS) -c charts/data-control-center \
-o README.md \
-t README.gotmpl.md \
-t _templates.gotmpl
.PHONY: lint
lint:
$(BUF) lint
$(BUF) breaking --against '.git#branch=main'
.PHONY: kubeconform
kubeconform:
@GO111MODULE=on go install github.com/yannh/kubeconform/cmd/kubeconform@v0.4.13
.PHONY: helm-validate
helm-validate: kubeconform
helm template charts/data-control-center | kubeconform -strict