Skip to content

Commit da8e30b

Browse files
authored
pin envtest version to fix unit-test (#194)
1 parent a5be8d3 commit da8e30b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ kind-load:
7979

8080
.PHONY: unit-test
8181
unit-test: manifests generate fmt vet envtest ## Run unit tests
82-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test -v -timeout 1800s -p 1 ./internal/controllers/... -ginkgo.v -coverprofile cover.out
82+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use --arch=amd64 $(ENVTEST_K8S_VERSION) -p path)" go test -v -timeout 1800s -p 1 ./internal/controllers/... -ginkgo.v -coverprofile cover.out
8383

8484
.PHONY: e2e-test
8585
e2e-test: manifests generate fmt vet docker-build kind-init kind-load ## Run e2e tests
@@ -104,12 +104,17 @@ docker-push: ## Push docker image with the manager.
104104
docker push ${IMG}
105105

106106
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
107+
CONTROLLER_GEN_VERSION ?= v0.6.1
107108
controller-gen: ## Download controller-gen locally if necessary.
108-
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.1)
109+
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_GEN_VERSION))
109110

111+
# ENVTEST_VERSION is usually latest, but might need to be pinned from time to time.
112+
# Version pinning is needed due to version incompatibility between controller-runtime and setup-envtest.
113+
# For more information: https://github.com/kubernetes-sigs/controller-runtime/issues/2744
110114
ENVTEST = $(shell pwd)/bin/setup-envtest
115+
ENVTEST_VERSION ?= release-0.16
111116
envtest: ## Download envtest-setup locally if necessary.
112-
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
117+
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@$(ENVTEST_VERSION))
113118

114119
# go-get-tool will 'go install' any package $2 and install it to $1.
115120
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))

0 commit comments

Comments
 (0)