Skip to content
Open
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
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,17 @@ $(CONTROLLER_GEN): $(LOCALBIN)
fi
@ln -sf "$(LOCALBIN)/$(BRANCH_VERSION)/controller-gen" "$(LOCALBIN)/controller-gen"

# Remove setup-envtest if it exists but cannot execute on this platform.
# This can happen when a containerized Make target (e.g. podman/docker build
# with a different GOARCH) writes a linux binary into the shared bin/ directory,
# replacing the native host binary needed by `make test`.
.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
@if [ -f $(ENVTEST) ] && ! $(ENVTEST) --help >/dev/null 2>&1; then \
echo "Removing incompatible setup-envtest binary"; \
rm -f $(ENVTEST); \
fi
$(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20250308055145-5fe7bb3edc86)
Comment on lines 327 to 334
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The incompatibility check is inside the $(ENVTEST) file target recipe, but that recipe won’t run when $(ENVTEST) already exists and is considered up-to-date. In the exact scenario this PR describes (a wrong-arch bin/setup-envtest already present), make test will usually skip this recipe and the bad binary won’t be removed. Consider making the compatibility check run unconditionally (e.g., move the check into the .PHONY: envtest target, or add a phony FORCE prerequisite to $(ENVTEST) so the recipe always executes; go-install-tool already avoids re-installing when the file is present).

Copilot uses AI. Check for mistakes.

.PHONY: operator-sdk
Expand Down