From b9e34123c85920d786f315715cfb78fb879354ba Mon Sep 17 00:00:00 2001 From: leigh capili Date: Mon, 8 Jun 2026 01:28:04 -0600 Subject: [PATCH] build: target host architecture for local builds and envtest Local container image builds and envtest binaries were pinned to amd64, forcing emulation (Rosetta) on Apple Silicon and other arm64 hosts. This produced amd64 controller images and amd64 envtest binaries locally, which can surface subtle runtime bugs. envtest now publishes arm64 binaries (including darwin/arm64), so the historical amd64 pin and the Darwin-specific override are no longer needed. Derive the architecture from the host Go toolchain (go env GOARCH): - ENVTEST_ARCH now follows the host architecture. - BUILD_PLATFORMS defaults to linux/ so 'make docker-build' produces a native image. Multi-arch release images are built by the fluxcd/gha-workflows release workflow, not by 'make docker-build', so release artifacts are unaffected. Both values remain overridable for cross-arch builds. Signed-off-by: leigh capili --- Makefile | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 2a1809315..781899c20 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,10 @@ SKIP_COSIGN_VERIFICATION ?= false # Allows for defining additional Docker buildx arguments, # e.g. '--push'. BUILD_ARGS ?= -# Architectures to build images for -BUILD_PLATFORMS ?= linux/amd64,linux/arm64,linux/arm/v7 +# Host architecture, used so local builds and envtest target the host. +LOCALARCH ?= $(shell go env GOARCH) +# Architectures to build images for; defaults to the host architecture. +BUILD_PLATFORMS ?= linux/$(LOCALARCH) # Go additional tag arguments, e.g. 'integration', # this is append to the tag arguments required for static builds @@ -49,17 +51,8 @@ export GOBIN=$(shell go env GOBIN) endif export PATH:=${GOBIN}:${PATH} -# Architecture to use envtest with -ifeq ($(shell uname -m),x86_64) -ENVTEST_ARCH ?= amd64 -else -ENVTEST_ARCH ?= arm64 -endif - -ifeq ($(shell uname -s),Darwin) -# Envtest only supports darwin-amd64 -ENVTEST_ARCH=amd64 -endif +# Architecture to use envtest with; defaults to the host architecture. +ENVTEST_ARCH ?= $(LOCALARCH) all: manager