@@ -2,11 +2,13 @@ HAS_LINT := $(shell command -v golangci-lint;)
2
2
HAS_YAMLLINT := $(shell command -v yamllint;)
3
3
HAS_SHELLCHECK := $(shell command -v shellcheck;)
4
4
HAS_SETUP_ENVTEST := $(shell command -v setup-envtest;)
5
+ HAS_MOCKGEN := $(shell command -v mockgen;)
5
6
6
7
COMMIT := v1beta1-$(shell git rev-parse --short=7 HEAD)
7
8
KATIB_REGISTRY := docker.io/kubeflowkatib
8
9
CPU_ARCH ?= amd64
9
10
ENVTEST_K8S_VERSION ?= 1.24
11
+ MOCKGEN_VERSION ?= $(shell grep 'github.com/golang/mock' go.mod | cut -d ' ' -f 2)
10
12
11
13
# for pytest
12
14
PYTHONPATH := $(PYTHONPATH ) :$(CURDIR ) /pkg/apis/manager/v1beta1/python:$(CURDIR ) /pkg/apis/manager/health/python
@@ -21,9 +23,9 @@ test: envtest
21
23
envtest :
22
24
ifndef HAS_SETUP_ENVTEST
23
25
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@c7a98aa706379c4e5c79ea675c7f333192677971 # v0.12.3
24
- @echo "setup-envtest has been installed"
26
+ $(info "setup-envtest has been installed")
25
27
endif
26
- @echo "setup-envtest has already installed"
28
+ $(info "setup-envtest has already installed")
27
29
28
30
check : generate fmt vet lint
29
31
33
35
lint :
34
36
ifndef HAS_LINT
35
37
go install github.com/golangci/golangci-lint/cmd/
[email protected]
36
- @echo "golangci-lint has been installed"
38
+ $(info "golangci-lint has been installed")
37
39
endif
38
40
hack/verify-golangci-lint.sh
39
41
40
42
yamllint :
41
43
ifndef HAS_YAMLLINT
42
44
pip install yamllint
43
- @echo "yamllint has been installed"
45
+ $(info "yamllint has been installed")
44
46
endif
45
47
hack/verify-yamllint.sh
46
48
50
52
shellcheck :
51
53
ifndef HAS_SHELLCHECK
52
54
bash hack/install-shellcheck.sh
53
- @echo "shellcheck has been installed"
55
+ $(info "shellcheck has been installed")
54
56
endif
55
57
hack/verify-shellcheck.sh
56
58
@@ -66,18 +68,24 @@ undeploy:
66
68
bash scripts/v1beta1/undeploy.sh
67
69
68
70
# Run this if you update any existing controller APIs.
69
- # 1. Genereate deepcopy, clientset, listers, informers for the APIs (hack/update-codegen.sh)
71
+ # 1. Generate deepcopy, clientset, listers, informers for the APIs (hack/update-codegen.sh)
70
72
# 2. Generate open-api for the APIs (hack/update-openapigen)
71
73
# 3. Generate Python SDK for Katib (hack/gen-python-sdk/gen-sdk.sh)
72
74
# 4. Generate gRPC manager APIs (pkg/apis/manager/v1beta1/build.sh and pkg/apis/manager/health/build.sh)
75
+ # 5. Generate Go mock codes
73
76
generate :
74
77
ifndef GOPATH
75
78
$(error GOPATH not defined, please define GOPATH. Run "go help gopath" to learn more about GOPATH)
79
+ endif
80
+ ifndef HAS_MOCKGEN
81
+ go install github.com/golang/mock/mockgen@$(MOCKGEN_VERSION)
82
+ $(info "mockgen has been installed")
76
83
endif
77
84
go generate ./pkg/... ./cmd/...
78
85
hack/gen-python-sdk/gen-sdk.sh
79
86
pkg/apis/manager/v1beta1/build.sh
80
87
pkg/apis/manager/health/build.sh
88
+ hack/update-mockgen.sh
81
89
82
90
# Build images for the Katib v1beta1 components.
83
91
build : generate
0 commit comments