Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.26.0

# Adding .PHONY to hold command shortcuts.
.PHONY: release

Expand Down Expand Up @@ -100,12 +103,16 @@ all: test docker-build
# Run tests
test: build test-only

test-only:
@echo
@echo "If tests fail due to no matches for kind \"CustomResourceDefinition\" in version \"apiextensions.k8s.io/v1\","
@echo "please remove the old kubebuilder and reinstall it - https://book.kubebuilder.io/quick-start.html#installation"
@echo
go test ${DIRS} -coverprofile cover.out
LOCALBIN ?= $(shell pwd)/hack
ENVTEST ?= $(LOCALBIN)/setup-envtest

test-only: envtest
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ${DIRS} -coverprofile cover.out

.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest

# Builds all binaries (manager and kubectl) and manifests
build: generate fmt vet staticcheck manifests
Expand Down