From 6fdd37ad8170bfd18b26aa91648aa50e42935bc9 Mon Sep 17 00:00:00 2001 From: Timofei Larkin Date: Fri, 20 Nov 2026 00:32:01 +0100 Subject: [PATCH] build(cozyplane): keep the chart on a failed update Stage the download next to its destination so the final step is a rename on the same filesystem, and drop the staging directory when the download fails. The Cilium CRD recipe also fails on an HTTP error now instead of saving the error body as a CRD. Assisted-by: LLM Signed-off-by: Timofei Larkin --- packages/system/cozyplane-apiserver/Makefile | 9 +++++---- packages/system/cozyplane-cilium-crds/Makefile | 9 +++++++-- packages/system/cozyplane-kpr/Makefile | 9 +++++---- packages/system/cozyplane/Makefile | 9 +++++---- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/packages/system/cozyplane-apiserver/Makefile b/packages/system/cozyplane-apiserver/Makefile index 5ec1fd33a..555fc51d2 100644 --- a/packages/system/cozyplane-apiserver/Makefile +++ b/packages/system/cozyplane-apiserver/Makefile @@ -13,7 +13,8 @@ test: helm unittest . update: - tmp=$$(mktemp -d) && \ - curl -fsSL https://github.com/lllamnyp/cozyplane/archive/$(COZYPLANE_REF).tar.gz | \ - tar -xzf - -C "$$tmp" --strip-components=3 cozyplane-$(COZYPLANE_REF)/chart/cozyplane-apiserver && \ - rm -rf charts/cozyplane-apiserver && mkdir -p charts && mv "$$tmp" charts/cozyplane-apiserver + mkdir -p charts && tmp=$$(mktemp -d charts/.update.XXXXXX) && \ + { curl -fsSL https://github.com/lllamnyp/cozyplane/archive/$(COZYPLANE_REF).tar.gz | \ + tar -xzf - -C "$$tmp" --strip-components=3 cozyplane-$(COZYPLANE_REF)/chart/cozyplane-apiserver || \ + { rm -rf "$$tmp"; exit 1; }; } && \ + rm -rf charts/cozyplane-apiserver && mv "$$tmp" charts/cozyplane-apiserver diff --git a/packages/system/cozyplane-cilium-crds/Makefile b/packages/system/cozyplane-cilium-crds/Makefile index 385fba4d0..33b1fedfc 100644 --- a/packages/system/cozyplane-cilium-crds/Makefile +++ b/packages/system/cozyplane-cilium-crds/Makefile @@ -10,6 +10,11 @@ include ../../../hack/package.mk # charts emit would reject their objects. CILIUM_VERSION=1.19.5 +CRDS_URL=https://raw.githubusercontent.com/cilium/cilium/v$(CILIUM_VERSION)/pkg/k8s/apis/cilium.io/client/crds/v2 + update: - curl -sSL https://raw.githubusercontent.com/cilium/cilium/v$(CILIUM_VERSION)/pkg/k8s/apis/cilium.io/client/crds/v2/ciliumnetworkpolicies.yaml -o templates/ciliumnetworkpolicies.yaml - curl -sSL https://raw.githubusercontent.com/cilium/cilium/v$(CILIUM_VERSION)/pkg/k8s/apis/cilium.io/client/crds/v2/ciliumclusterwidenetworkpolicies.yaml -o templates/ciliumclusterwidenetworkpolicies.yaml + tmp=$$(mktemp -d .update.XXXXXX) && \ + { curl -fsSL $(CRDS_URL)/ciliumnetworkpolicies.yaml -o "$$tmp/ciliumnetworkpolicies.yaml" && \ + curl -fsSL $(CRDS_URL)/ciliumclusterwidenetworkpolicies.yaml -o "$$tmp/ciliumclusterwidenetworkpolicies.yaml" || \ + { rm -rf "$$tmp"; exit 1; }; } && \ + mv "$$tmp"/*.yaml templates/ && rmdir "$$tmp" diff --git a/packages/system/cozyplane-kpr/Makefile b/packages/system/cozyplane-kpr/Makefile index e6d00b6d4..8d577ebf5 100644 --- a/packages/system/cozyplane-kpr/Makefile +++ b/packages/system/cozyplane-kpr/Makefile @@ -13,7 +13,8 @@ test: helm unittest . update: - tmp=$$(mktemp -d) && \ - curl -fsSL https://github.com/lllamnyp/cozyplane/archive/$(COZYPLANE_REF).tar.gz | \ - tar -xzf - -C "$$tmp" --strip-components=3 cozyplane-$(COZYPLANE_REF)/chart/cozyplane-kpr && \ - rm -rf charts/cozyplane-kpr && mkdir -p charts && mv "$$tmp" charts/cozyplane-kpr + mkdir -p charts && tmp=$$(mktemp -d charts/.update.XXXXXX) && \ + { curl -fsSL https://github.com/lllamnyp/cozyplane/archive/$(COZYPLANE_REF).tar.gz | \ + tar -xzf - -C "$$tmp" --strip-components=3 cozyplane-$(COZYPLANE_REF)/chart/cozyplane-kpr || \ + { rm -rf "$$tmp"; exit 1; }; } && \ + rm -rf charts/cozyplane-kpr && mv "$$tmp" charts/cozyplane-kpr diff --git a/packages/system/cozyplane/Makefile b/packages/system/cozyplane/Makefile index d3eabb19a..e5ee9f825 100644 --- a/packages/system/cozyplane/Makefile +++ b/packages/system/cozyplane/Makefile @@ -13,7 +13,8 @@ test: helm unittest . update: - tmp=$$(mktemp -d) && \ - curl -fsSL https://github.com/lllamnyp/cozyplane/archive/$(COZYPLANE_REF).tar.gz | \ - tar -xzf - -C "$$tmp" --strip-components=3 cozyplane-$(COZYPLANE_REF)/chart/cozyplane && \ - rm -rf charts/cozyplane && mkdir -p charts && mv "$$tmp" charts/cozyplane + mkdir -p charts && tmp=$$(mktemp -d charts/.update.XXXXXX) && \ + { curl -fsSL https://github.com/lllamnyp/cozyplane/archive/$(COZYPLANE_REF).tar.gz | \ + tar -xzf - -C "$$tmp" --strip-components=3 cozyplane-$(COZYPLANE_REF)/chart/cozyplane || \ + { rm -rf "$$tmp"; exit 1; }; } && \ + rm -rf charts/cozyplane && mv "$$tmp" charts/cozyplane