forked from fission/fission
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
137 lines (105 loc) · 4.17 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Copyright 2017 The Fission Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
.DEFAULT_GOAL := check
SKAFFOLD_PROFILE ?= kind
VERSION ?= v0.0.0
TIMESTAMP ?= $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
COMMITSHA ?= $(shell git rev-parse HEAD)
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
GOAMD64 ?= $(shell go env GOAMD64)
GOPATH ?= $(shell go env GOPATH)
FISSION-CLI-SUFFIX :=
ifeq ($(GOOS), windows)
FISSION-CLI-SUFFIX := .exe
endif
# Show this help.
help:
@awk '/^#/{c=substr($$0,3);next}c&&/^[[:alpha:]][[:alnum:]_-]+:/{print substr($$1,1,index($$1,":")),c}1{c=0}' $(MAKEFILE_LIST) | column -s: -t
print-%:
@echo '$*=$($*)'
debug-vars: print-GOOS print-GOARCH print-GOAMD64 print-VERSION print-TIMESTAMP print-COMMITSHA print-FISSION-CLI-SUFFIX print-SKAFFOLD_PROFILE
### Static checks
check: test-run build-fission-cli clean
code-checks:
golangci-lint run
# run basic check scripts
test-run: code-checks
hack/runtests.sh
@rm -f coverage.txt
### Binaries
build-fission-cli:
@GOOS=$(GOOS) GOARCH=$(GOARCH) GOAMD64=$(GOAMD64) GORELEASER_CURRENT_TAG=$(VERSION) goreleaser build --snapshot --clean --single-target --id fission-cli
install-fission-cli:
# TODO: Fix this hack, replace v1 with GOAMD64
mv dist/fission-cli_$(GOOS)_$(GOARCH)_v1/fission$(FISSION-CLI-SUFFIX) /usr/local/bin/fission
### Codegen
codegen: controller-gen-install
@./hack/update-codegen.sh
$(GOPATH)/bin/controller-gen object:headerFile="hack/boilerplate.txt" paths="./..."
### CRDs
controller-gen-install:
go install sigs.k8s.io/controller-tools/cmd/[email protected]
generate-crds: controller-gen-install
$(GOPATH)/bin/controller-gen crd \
paths=./pkg/apis/core/v1 \
output:crd:artifacts:config=crds/v1
### Webhook generation: it generates webhook configs with help of kubebuilder:webhook tag
generate-webhooks: controller-gen-install
$(GOPATH)/bin/controller-gen webhook \
paths=./pkg/apis/core/v1 \
output:dir=charts/fission-all/templates/webhook-server
create-crds:
@kubectl create -k crds/v1
update-crds:
@kubectl replace -k crds/v1
delete-crds:
@kubectl delete -k crds/v1
### Cleanup
clean:
@rm -f dist/
### Misc
generate-swagger-doc:
@./hack/update-swagger-docs.sh
generate-cli-docs:
go run tools/cmd-docs/main.go -o "../fission.io/content/en/docs/reference/fission-cli"
install-crd-ref-docs:
go install github.com/elastic/[email protected]
generate-crd-ref-docs: install-crd-ref-docs
# crd-ref-docs: https://github.com/elastic/crd-ref-docs
$(GOPATH)/bin/crd-ref-docs --source-path=pkg/apis/core/v1 --config=tools/crd-ref-docs/config.yaml --renderer markdown
cp tools/crd-ref-docs/header.md crd_docs.md
cat out.md >> crd_docs.md && rm out.md
mv crd_docs.md ../fission.io/content/en/docs/reference/crd-reference.md
all-generators: codegen generate-crds generate-swagger-doc generate-cli-docs generate-crd-ref-docs
skaffold-prebuild:
@GOOS=linux GOARCH=amd64 GORELEASER_CURRENT_TAG=$(VERSION) goreleaser build --snapshot --clean --single-target
@cp -v cmd/builder/Dockerfile dist/builder_linux_amd64_v1/Dockerfile
@cp -v cmd/fetcher/Dockerfile dist/fetcher_linux_amd64_v1/Dockerfile
@cp -v cmd/fission-bundle/Dockerfile dist/fission-bundle_linux_amd64_v1/Dockerfile
@cp -v cmd/reporter/Dockerfile dist/reporter_linux_amd64_v1/Dockerfile
@cp -v cmd/preupgradechecks/Dockerfile dist/pre-upgrade-checks_linux_amd64_v1/Dockerfile
skaffold-deploy: skaffold-prebuild
skaffold run -p $(SKAFFOLD_PROFILE)
### Release
release:
@./hack/generate-helm-manifest.sh $(VERSION)
@./hack/release.sh $(VERSION)
@./hack/release-tag.sh $(VERSION)
@./hack/changelog.sh
## Envtest
install-envtest:
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
setup-envtest:
setup-envtest -p path use 1.23.x