forked from dominodatalab/hephaestus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (51 loc) · 2.3 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
SHELL:=/bin/bash
ifndef $(GOPATH)
GOPATH=$(shell go env GOPATH)
export GOPATH
endif
##@ Development
.PHONY: build
build: ## Build controller binary
go build -v -o bin/hephaestus-controller ./cmd/controller/
docker: ## Build docker image
docker build -t ghcr.io/dominodatalab/hephaestus:latest .
.PHONY: test
test: ## Run test suite
go test -v -timeout=5m -race ./...
lint: tools ## Run linter suite
golangci-lint run ./...
apply: crds ## Apply CRDs to cluster
kubectl apply -f deployments/crds
delete: crds ## Delete CRDs from cluster
kubectl delete -f deployments/crds
check: compiled ## Ensure generated files and dependencies are up-to-date
go mod tidy -v
cd tools && go mod tidy -v
git update-index --refresh
git diff-index --exit-code --name-status HEAD
##@ Generators
api: tools ## Generate API objects
controller-gen object paths="./pkg/api/hephaestus/..."
crds: tools ## Generate CRDs
controller-gen crd paths="./..." output:crd:artifacts:config=deployments/crds
client: tools ## Generate Go client API library
client-gen --clientset-name "clientset" --input-base "github.com/dominodatalab/hephaestus/pkg/api" --input "hephaestus/v1" --output-package "github.com/dominodatalab/hephaestus/pkg" --go-header-file "$(shell mktemp)"
compiled: api crds client ## Generate all compiled code
openapi: ## Generate OpenAPI definitions for API types
go install k8s.io/kube-openapi/cmd/openapi-gen@$(shell go list -m k8s.io/kube-openapi | awk '{print $$2}')
openapi-gen \
--go-header-file "$(shell mktemp)" \
--input-dirs github.com/dominodatalab/hephaestus/pkg/api/hephaestus/v1 \
--output-package github.com/dominodatalab/hephaestus/pkg/api/hephaestus/v1 \
--output-file-base zz_generated.openapi \
--report-filename api/api-rules/violation_exceptions.list
sdks: crds openapi ## Generate non-GO client libraries
scripts/sdk/generate.sh
##@ Misc
.PHONY: tools
tools: ## Install go tooling
@echo Installing tools from tools/tools.go
@cd tools && go list -e -f '{{range .Imports}}{{.}}{{"\n"}}{{end}}' tools.go | xargs -I % go install %
.DEFAULT_GOAL:=help
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)