mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-09 05:25:14 +09:00
Every package Makefile tagged images via `settag` which, on a non-release commit, collapsed to `:latest`. Concurrent PR builds therefore raced on every image's `:latest` manifest in the OCIR registry. Two outliers (metallb, redis-operator) used hardcoded version tags and collided across PRs even when `settag` would not have. Replace `settag` and the `TAG=latest` fallback with an `image-tags` macro driven by three env vars: - IMAGE_TAG — build-unique tag, always pushed - PUBLISH_VERSIONED — also push :<component-version> - PUBLISH_FLOATING — also push :latest PR CI sets IMAGE_TAG=pr-<N>-<sha> with both PUBLISH_* off, so every push is unique across runs. Release CI sets IMAGE_TAG=<git-tag> with both PUBLISH_* on, preserving the previous release output and adding a uniform :<git-tag> tag across every image. Local builds default to IMAGE_TAG=dev with PUSH=0 already off. Image consumers reference digests pinned into values.yaml by each Makefile, so the tag is decorative for cluster-side pulls; the build-unique tag is sufficient for E2E. Drops the redundant `:<component-version>-<git-tag>` form (cilium, linstor, matchbox, ubuntu-container-disk, kubevirt-*, cluster-autoscaler) — nothing in the repo or downstream values.yaml consumed it. The same information is preserved via the new uniform `:<git-tag>` plus the existing `:<component-version>` on release. ubuntu-container-disk builds a separate image per Kubernetes version in a loop. Switched its primary tag to `:<k8s-ver>-<IMAGE_TAG>` so loop iterations within a single build do not push to the same tag. Assisted-By: Claude <noreply@anthropic.com> Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
30 lines
1.4 KiB
Makefile
30 lines
1.4 KiB
Makefile
export NAME=objectstorage-controller
|
|
export NAMESPACE=cozy-$(NAME)
|
|
|
|
include ../../../hack/common-envs.mk
|
|
include ../../../hack/package.mk
|
|
|
|
update:
|
|
rm -rf templates
|
|
mkdir -p templates
|
|
kubectl kustomize github.com/kubernetes-sigs/container-object-storage-interface > templates/controller.yaml
|
|
sed -i 's/namespace: container-object-storage-system/namespace: {{ .Release.Namespace }}/g' templates/controller.yaml
|
|
sed -i 's|image:.*|image: {{ .Values.objectstorage.controller.image }}|' templates/controller.yaml
|
|
|
|
image: image-controller image-sidecar
|
|
image-controller image-sidecar:
|
|
$(eval TARGET := $(subst image-,,$@))
|
|
$(eval VALUES_FILE := $(if $(filter sidecar,$(TARGET)),../seaweedfs/values.yaml,values.yaml))
|
|
$(eval YAML_PATH := $(if $(filter sidecar,$(TARGET)),.seaweedfs.cosi.sidecar.image,.objectstorage.controller.image))
|
|
docker buildx build images/objectstorage \
|
|
--target $(TARGET) \
|
|
$(call image-tags,objectstorage-$(TARGET),v$(COZYSTACK_VERSION)) \
|
|
--cache-from type=registry,ref=$(REGISTRY)/objectstorage-$(TARGET):latest \
|
|
--cache-to type=inline \
|
|
--metadata-file images/$(TARGET).json \
|
|
$(BUILDX_ARGS)
|
|
IMAGE="$(REGISTRY)/objectstorage-$(TARGET):$(IMAGE_TAG)@$$(yq e '."containerimage.digest"' images/$(TARGET).json -r)" \
|
|
yq -i '$(YAML_PATH) = strenv(IMAGE)' $(VALUES_FILE)
|
|
rm -f images/$(TARGET).json
|
|
yq .seaweedfs.cosi.sidecar.image ../seaweedfs/values.yaml > ../../extra/seaweedfs/images/objectstorage-sidecar.tag
|