- Notifications
You must be signed in to change notification settings - Fork9
/
Copy pathMakefile
214 lines (149 loc) · 5.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# Tekton operator version
TEKTON_OPERATOR_VERSION=v0.51.2
# Image URL to use all building/pushing image targets
IMG ?= fuseml-installer:latest
GOOS:=$(shell go env GOOS)
GOARCH:=$(shell go env GOARCH)
LDFLAGS:= -w -s
PKG_PATH=github.com/fuseml/fuseml/cli/paas
GIT_COMMIT =$(shell git rev-parse --short=8 HEAD)
GIT_BRANCH =$(shell git rev-parse --abbrev-ref HEAD|grep -v HEAD)
GIT_TAG =$(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
BUILD_DATE =$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
ifdefVERSION
BINARY_VERSION = $(VERSION)
else
# Use `dev` as a default version value when compiling in the main branch
ifeq ($(GIT_BRANCH),main)
BINARY_VERSION = dev
# Use the branch name as a default version value when compiling in another branch
else
BINARY_VERSION = $(GIT_BRANCH)
endif
ifneq ($(GIT_TAG),)
BINARY_VERSION = $(GIT_TAG)
else
endif
endif
LDFLAGS += -X$(PKG_PATH)/version.GitCommit=$(GIT_COMMIT)
LDFLAGS += -X$(PKG_PATH)/version.BuildDate=$(BUILD_DATE)
ifneq ($(BINARY_VERSION),)
LDFLAGS += -X$(PKG_PATH)/version.Version=$(BINARY_VERSION)
endif
########################################################################
## Development
# Embed files, run linter and build FuseML installer binary
build: embed_files lint build-installer
build-installer:
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -ldflags'$(LDFLAGS)' -o dist/fuseml-installer
test: embed_files
ginkgo ./cmd/internal/client/ ./tools/ ./helpers/ ./kubernetes/
test-acceptance-traefik: embed_files
@./scripts/test-acceptance.sh -- -serve=deployment
test-acceptance-knative: embed_files
@./scripts/test-acceptance.sh -- -serve=knative
test-acceptance-kserve: embed_files
@./scripts/test-acceptance.sh -- -serve=kserve
test-acceptance-seldon_mlflow: embed_files
@./scripts/test-acceptance.sh -- -serve=seldon_mlflow
test-acceptance-seldon_sklearn: embed_files
@./scripts/test-acceptance.sh -- -serve=seldon_sklearn
generate:
go generate ./...
lint:embed_files fmt vet tidy
vet:
go vet ./...
tidy:
go mod tidy
fmt:
go fmt ./...
gitlint:
gitlint --commits"origin..HEAD"
.PHONY: tools
tools:
go install github.com/rakyll/statik
update_registry:
helm package ./assets/trow/ -d embedded-files
update_charts: update_registry
update_tekton:
mkdir -p embedded-files/tekton/install
wget https://github.com/tektoncd/operator/releases/download/${TEKTON_OPERATOR_VERSION}/release.yaml -O embedded-files/tekton/install/operator.yaml
wget https://raw.githubusercontent.com/tektoncd/operator/${TEKTON_OPERATOR_VERSION}/config/crs/kubernetes/config/all/operator_v1alpha1_config_cr.yaml -O embedded-files/tekton/install/profile-all.yaml
embed_files: tools
statik -m -f -src=./embedded-files
help:
(echo _ _ ___ _____ ________ Overview; fusemlhelp;forcmdin completionhelp info install uninstall;doecho;echo _ _ ___ _____ ________ Command$$cmd; fuseml$$cmd --help;done;echo )| tee HELP
########################################################################
## Release
# Embed files, run linter and build release-ready archived binaries for all supported ARCHs and OSs
release: embed_files lint release-all
release-installer: build-installer
tar zcf dist/fuseml-installer-$(GOOS)-$(GOARCH).tar.gz -C dist/ --remove-files --transform="s#\.\/##" ./fuseml-installer
cd dist&& sha256sum -b fuseml-installer-$(GOOS)-$(GOARCH).tar.gz> fuseml-installer-$(GOOS)-$(GOARCH).tar.gz.sha256
release-all: release-amd64 release-arm64 release-arm32 release-darwin-amd64 release-darwin-arm64 release-windows
release-arm32:
$(MAKE) GOARCH="arm" GOOS="linux" release-installer
release-arm64:
$(MAKE) GOARCH="arm64" GOOS="linux" release-installer
release-amd64:
$(MAKE) GOARCH="amd64" GOOS="linux" release-installer
release-darwin-amd64:
$(MAKE) GOARCH="amd64" GOOS="darwin" release-installer
release-darwin-arm64:
$(MAKE) GOARCH="arm64" GOOS="darwin" release-installer
release-windows:
$(MAKE) GOARCH="amd64" GOOS="windows" release-installer
########################################################################
# Support
tools-install:
@./scripts/tools-install.sh
tools-versions:
@./scripts/tools-versions.sh
istio-install:
@./scripts/istio-minimal-install.sh
seldon-install:
@./scripts/seldon-operator-install.sh
k3d-install:
curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh| bash
k3d version
new-test-cluster:
@./scripts/ci/k3d-cluster.sh create
delete-test-cluster:
@./scripts/ci/k3d-cluster.sh delete
mlflow-kserve-e2e:
@./scripts/ci/mlflow-e2e.sh
mlflow-seldon-e2e:
@./scripts/ci/mlflow-e2e.sh seldon
mlflow-seldon-triton-e2e:
@./scripts/ci/mlflow-e2e.sh seldon triton
mlflow-ovms-e2e:
@./scripts/ci/mlflow-e2e.sh ovms
fuseml-install:
@./dist/fuseml-installer install
fuseml-install-with-all-extensions:
@./dist/fuseml-installer install --extensions mlflow,kserve,seldon-core,ovms
fuseml-install-with-kserve:
@./dist/fuseml-installer install --extensions mlflow,kserve
fuseml-install-with-seldon:
@./dist/fuseml-installer install --extensions mlflow,seldon-core
fuseml-install-with-seldon-triton:
@./dist/fuseml-installer install --extensions mlflow,seldon-core
fuseml-install-with-ovms:
@./dist/fuseml-installer install --extensions mlflow,ovms
test-mlflow-e2e: build new-test-cluster fuseml-install-with-kserve mlflow-kserve-e2e delete-test-cluster
test-mlflow-seldon-e2e: build new-test-cluster fuseml-install-with-seldon mlflow-seldon-e2e delete-test-cluster
########################################################################
# Build the docker image
docker-build: test
docker build. -t${IMG} --build-arg LDFLAGS="$(LDFLAGS)"
# Push the docker image
docker-push:
docker push${IMG}
docker-release: test
docker buildx build. -t${IMG} --build-arg LDFLAGS="$(LDFLAGS)" --platform linux/amd64,linux/arm64,linux/arm/v7 --push
########################################################################
# Kube dev environments
minikube-start:
@./scripts/minikube-start.sh
minikube-delete:
@./scripts/minikube-delete.sh