@@ -29,9 +29,6 @@ GOPROXY := https://proxy.golang.org
2929endif
3030export GOPROXY
3131
32- # Active module mode, as we use go modules to manage dependencies
33- export GO111MODULE =on
34-
3532# Default timeout for starting/stopping the Kubebuilder test control plane
3633export KUBEBUILDER_CONTROLPLANE_START_TIMEOUT ?=60s
3734export KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT ?=60s
@@ -42,11 +39,7 @@ export DOCKER_CLI_EXPERIMENTAL := enabled
4239CURL_RETRIES =3
4340
4441# Directories.
45- ROOT_DIR: =$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST ) ) ) )
46- TOOLS_DIR := hack/tools
47- TOOLS_BIN_DIR := $(abspath $(TOOLS_DIR ) /bin)
48- BIN_DIR := $(abspath $(ROOT_DIR ) /bin)
49- GO_INSTALL = ./scripts/go_install.sh
42+ TOOLS_BIN_DIR := $(abspath bin)
5043
5144# Binaries.
5245CONTROLLER_GEN := go run sigs.k8s.io/controller-tools/cmd/
[email protected] @@ -55,28 +48,16 @@ GOLANGCI_LINT_VER := v2.3.0
5548GOLANGCI_LINT_BIN := golangci-lint
5649GOLANGCI_LINT := $(TOOLS_BIN_DIR ) /$(GOLANGCI_LINT_BIN ) -$(GOLANGCI_LINT_VER )
5750
51+ KUSTOMIZE_VER := v5.7.1
5852KUSTOMIZE_BIN := kustomize
59- KUSTOMIZE := $(TOOLS_BIN_DIR ) /$(KUSTOMIZE_BIN )
60-
61- KUBECTL_VER := v1.33.0
62- KUBECTL_BIN := kubectl
63- KUBECTL := $(TOOLS_BIN_DIR ) /$(KUBECTL_BIN ) -$(KUBECTL_VER )
64-
65- KIND_VER := v0.29.0
66- KIND_BIN := kind
67- KIND := $(TOOLS_BIN_DIR ) /$(KIND_BIN ) -$(KIND_VER )
53+ KUSTOMIZE := $(TOOLS_BIN_DIR ) /$(KUSTOMIZE_BIN ) -$(KUSTOMIZE_VER )
6854
69- toolsBins := $(addprefix ${TOOLS_BIN_DIR}/,$(notdir $(shell awk -F'"' '/^\s* _/ {print $$2}' tools.go | sed 's|/v[[:digit:]]\+||') ) )
70-
71- # installs cli tools defined in tools.go
72- $(toolsBins ) : go.mod go.sum tools.go
73- $(toolsBins ) : CMD=$(shell grep -w '$(@F ) ' tools.go | awk -F'"' '{print $$2}')
74- $(toolsBins ) :
75- echo " Installing $( CMD) "
76- GOBIN=$(TOOLS_BIN_DIR ) go install $(CMD )
55+ GINKGO_VER := v2.23.4
56+ GINKGO_BIN := ginkgo
57+ GINKGO := $(TOOLS_BIN_DIR ) /$(GINKGO_BIN ) -$(GINKGO_VER )
7758
7859.PHONY : tools
79- tools : ${toolsBins} # # Build Go based build tools
60+ tools : $( GINKGO ) $( KUSTOMIZE ) $( GOLANGCI_LINT ) # # Install build tools
8061
8162TIMEOUT := $(shell command -v timeout || command -v gtimeout)
8263
@@ -122,7 +103,7 @@ help: ## Display this help
122103
123104.PHONY : test
124105test : # # Run tests
125- source ./scripts/fetch_ext_bins.sh ; fetch_tools ; setup_envs ; go test -v ./... -coverprofile cover.out
106+ go test -v ./... -coverprofile cover.out
126107
127108# # --------------------------------------
128109# # Tooling Binaries
@@ -142,6 +123,16 @@ $(KIND): ## Build kind
142123 ln -sf " $( KIND) " " $( TOOLS_BIN_DIR) /$( KIND_BIN) "
143124 chmod +x " $( TOOLS_BIN_DIR) /$( KIND_BIN) " " $( KIND) "
144125
126+ $(GINKGO ) : # # Build ginkgo
127+ mkdir -p $(TOOLS_BIN_DIR )
128+ GOBIN=$(TOOLS_BIN_DIR ) go install github.com/onsi/ginkgo/v2/ginkgo@${GINKGO_VER}
129+ @mv $(TOOLS_BIN_DIR ) /ginkgo $(GINKGO )
130+
131+ $(KUSTOMIZE ) : # # Install kustomize
132+ mkdir -p $(TOOLS_BIN_DIR )
133+ GOBIN=$(TOOLS_BIN_DIR ) go install sigs.k8s.io/kustomize/kustomize/v5@${KUSTOMIZE_VER}
134+ @mv $(TOOLS_BIN_DIR ) /kustomize $(KUSTOMIZE )
135+
145136# # --------------------------------------
146137# # Linting
147138# # --------------------------------------
@@ -204,7 +195,7 @@ generate: ## Generate code
204195generate-go : tools # # Runs Go related generate targets
205196 $(CONTROLLER_GEN ) \
206197 paths=./api/... \
207- object:headerFile=./hack /boilerplate.go.txt
198+ object:headerFile=./config /boilerplate.go.txt
208199 go generate ./...
209200
210201.PHONY : generate-manifests
@@ -314,7 +305,6 @@ clean: clean-bin clean-temporary clean-release ## Remove all generated files
314305.PHONY : clean-bin
315306clean-bin : # # Remove all generated binaries
316307 rm -rf bin
317- rm -rf hack/tools/bin
318308
319309.PHONY : clean-temporary
320310clean-temporary : # # Remove all temporary files and folders
@@ -328,13 +318,9 @@ clean-release: ## Remove the release folder
328318.PHONY : verify
329319verify : verify-modules verify-gen
330320
331- .PHONY : verify-boilerplate
332- verify-boilerplate :
333- ./hack/verify-boilerplate.sh
334-
335321.PHONY : verify-modules
336322verify-modules : modules
337- @if ! (git diff --quiet HEAD -- go.sum go.mod hack/tools/go.mod hack/tools/go.sum ); then \
323+ @if ! (git diff --quiet HEAD -- go.sum go.mod); then \
338324 echo " go module files are out of date" ; exit 1; \
339325 fi
340326
0 commit comments