From 267e8cfe94e6dcc917d88e24446575227ea20fa0 Mon Sep 17 00:00:00 2001 From: OpenShift Cherrypick Robot Date: Fri, 13 Feb 2026 08:40:00 +0100 Subject: [PATCH] fix: replace broken kubebuilder-tools download with setup-envtest (#1390) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.ai/code) Signed-off-by: Qing Hao Co-authored-by: Qing Hao Co-authored-by: Claude --- test/integration-test.mk | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/test/integration-test.mk b/test/integration-test.mk index 3028bde2b..da76b67c4 100644 --- a/test/integration-test.mk +++ b/test/integration-test.mk @@ -3,23 +3,33 @@ TEST_TMP :=/tmp export KUBEBUILDER_ASSETS ?=$(TEST_TMP)/kubebuilder/bin K8S_VERSION ?=1.30.0 -KB_TOOLS_ARCHIVE_NAME :=kubebuilder-tools-$(K8S_VERSION)-$(GOHOSTOS)-$(GOHOSTARCH).tar.gz -KB_TOOLS_ARCHIVE_PATH := $(TEST_TMP)/$(KB_TOOLS_ARCHIVE_NAME) +SETUP_ENVTEST := $(shell go env GOPATH)/bin/setup-envtest # download the kubebuilder-tools to get kube-apiserver binaries from it ensure-kubebuilder-tools: ifeq "" "$(wildcard $(KUBEBUILDER_ASSETS))" $(info Downloading kube-apiserver into '$(KUBEBUILDER_ASSETS)') mkdir -p '$(KUBEBUILDER_ASSETS)' - curl -s -f -L https://storage.googleapis.com/kubebuilder-tools/$(KB_TOOLS_ARCHIVE_NAME) -o '$(KB_TOOLS_ARCHIVE_PATH)' - tar -C '$(KUBEBUILDER_ASSETS)' --strip-components=2 -zvxf '$(KB_TOOLS_ARCHIVE_PATH)' +ifeq "" "$(wildcard $(SETUP_ENVTEST))" + $(info Installing setup-envtest into '$(SETUP_ENVTEST)') + go install sigs.k8s.io/controller-runtime/tools/setup-envtest@release-0.22 +endif + ENVTEST_K8S_PATH=$$($(SETUP_ENVTEST) use $(K8S_VERSION) --bin-dir $(KUBEBUILDER_ASSETS) -p path); \ + if [ -z "$$ENVTEST_K8S_PATH" ]; then \ + echo "Error: setup-envtest returned empty path"; \ + exit 1; \ + fi; \ + if [ ! -d "$$ENVTEST_K8S_PATH" ]; then \ + echo "Error: setup-envtest path does not exist: $$ENVTEST_K8S_PATH"; \ + exit 1; \ + fi; \ + cp -r $$ENVTEST_K8S_PATH/* $(KUBEBUILDER_ASSETS)/ else $(info Using existing kube-apiserver from "$(KUBEBUILDER_ASSETS)") endif .PHONY: ensure-kubebuilder-tools clean-integration-test: - $(RM) '$(KB_TOOLS_ARCHIVE_PATH)' rm -rf $(TEST_TMP)/kubebuilder $(RM) ./*integration.test .PHONY: clean-integration-test