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 <lllamnyp@gmail.com>
This commit is contained in:
Timofei Larkin committed 2026-11-20 00:32:01 +01:00
1 parent 0913b8d046
commit 6fdd37ad81
4 files changed
+22 -14

No files matched your search

+5 -4
View File
@@ -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
@@ -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"
+5 -4
View File
@@ -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
+5 -4
View File
@@ -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