Files
cozystack/packages/system/dashboard/Makefile
Aleksei Sviridkin 623113f920 fix(build): pass the shared buildx flags from every image target
Three package Makefiles spelled out their docker buildx flags instead
of using $(BUILDX_ARGS) from hack/common-envs.mk: flux-plunger,
kubeovn-plunger and both dashboard images. kubeovn-plunger landed just
before the change that moved the other Makefiles onto BUILDX_ARGS,
flux-plunger was modelled on it, and dashboard kept its own flags when
that change touched it.

Those targets ignored PLATFORM, SBOM and BUILDX_EXTRA_ARGS. On an arm64
workstation the plungers came out as arm64 images, which fail on amd64
nodes with "exec format error"; CI builds on amd64 and never saw it.
Dashboard and metallb hardcoded --platform=linux/amd64 instead; for
metallb that sat next to $(BUILDX_ARGS), so setting PLATFORM gave buildx
two platforms and a multi-platform build.

All of them now build through $(BUILDX_ARGS) alone. CI sets only
BUILDER, which these targets already honoured, and runs on amd64, so
its builds are unchanged. Local builds of dashboard and metallb now
follow the host architecture like every other package: on an arm64
machine build them for an amd64 cluster with PLATFORM=linux/amd64.

A bats test dry-runs every package image target with a probe platform
and a marker in BUILDX_EXTRA_ARGS, and requires each buildx call to
carry the marker, so $(BUILDX_ARGS) is really passed, and that
platform and no other.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-26 14:32:44 +03:00

48 lines
1.5 KiB
Makefile

export NAME=dashboard
export NAMESPACE=cozy-$(NAME)
include ../../../hack/common-envs.mk
include ../../../hack/package.mk
.PHONY: image image-console image-token-proxy test test-go test-helm
.PHONY: build-console update-values-console
.NOTPARALLEL: image
test: test-helm test-go
test-helm:
helm unittest .
test-go:
cd images/token-proxy && go test ./...
image: image-console image-token-proxy
image-console: build-console update-values-console
# Console source lives in-tree under images/console (vendored from the former
# cozystack-ui repo). Build from that context directly — no clone step.
build-console:
docker buildx build images/console \
--file images/console/Containerfile \
$(call image-tags,cozystack-ui,v$(COZYSTACK_VERSION)) \
$(call cache-args,cozystack-ui) \
--metadata-file images/console.json \
--build-arg APP_VERSION=$(if $(COZYSTACK_VERSION),v$(COZYSTACK_VERSION),) \
$(BUILDX_ARGS)
update-values-console:
IMAGE="$(REGISTRY)/cozystack-ui:$(IMAGE_TAG)@$$(yq e '."containerimage.digest"' images/console.json -r)" \
yq -i '.console.image = strenv(IMAGE)' values.yaml
rm -f images/console.json
image-token-proxy:
docker buildx build images/token-proxy \
$(call image-tags,token-proxy,v$(COZYSTACK_VERSION)) \
$(call cache-args,token-proxy) \
--metadata-file images/token-proxy.json \
$(BUILDX_ARGS)
IMAGE="$(REGISTRY)/token-proxy:$(IMAGE_TAG)@$$(yq e '."containerimage.digest"' images/token-proxy.json -r)" \
yq -i '.tokenProxy.image = strenv(IMAGE)' values.yaml
rm -f images/token-proxy.json