mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-05 03:27:07 +09:00
`--cache-to type=inline` only exports the final stage. 25 of 38 Dockerfiles are multistage, so the expensive `builder` stages (Go/Node compiles) were never cached even with a warm tag. Switch every image to a shared mode=max registry cache. - New `cache-args` macro (hack/common-envs.mk) emits `--cache-from` always and `--cache-to … mode=max` only when WRITE_CACHE=1, so PR builds stay read-only and concurrent PRs never race on the cache ref (the 409 class #2711 fixed for tags). oci-mediatypes/image-manifest keep the cache manifest portable across registries. - Cache ref is CACHE_REGISTRY/<img>:buildcache, co-located with the build registry (CACHE_REGISTRY now defaults to $(REGISTRY)). - New build-main.yaml warms :buildcache on every push to main (WRITE_CACHE=1), serialized via concurrency. All 31 package image recipes converted from the inline cache-from/cache-to pair to `$(call cache-args,…)`; ubuntu-container-disk keeps a per-k8s-version cache tag. Verified with `make -n image` across all packages in both PR (read-only) and main (mode=max write) contexts. Part of #2937. Assisted-By: Claude <noreply@anthropic.com> Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
29 lines
1.4 KiB
Makefile
29 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)) \
|
|
$(call cache-args,objectstorage-$(TARGET)) \
|
|
--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
|