From e1b7b7af896964bbe8d0a73ded7ff3bd05c43ab6 Mon Sep 17 00:00:00 2001 From: Guillaume Berche Date: Tue, 2 Jan 2024 16:38:55 +0100 Subject: [PATCH] Refine addblob.sh to upload blobs to s3 (fixup) Call bosh upload-blobs after all blobs were added --- addblob.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/addblob.sh b/addblob.sh index 64ff410b..aa088c2c 100755 --- a/addblob.sh +++ b/addblob.sh @@ -2,6 +2,11 @@ set -x set -e # exit on non-zero status +echo "Current blobs" +bosh blobs + +NEW_BLOBS_WERE_ADDED="false" + # params # $1: src # $2: target @@ -13,11 +18,11 @@ function addBlobOnChecksumChange() { src_checksum=$(cat "${src}" | sha256sum | cut -d " " -f1) if [ "${blob_checksum}" != "sha256:${src_checksum}" ] || [ "$blob_object_id" = "null" ]; then bosh add-blob ${src} ${target} - # See https://bosh.io/docs/release-blobs/#saving-blobs - bosh upload-blobs + NEW_BLOBS_WERE_ADDED="true" else echo "skipping blob creation for ${target} with existing checksum: ${src_checksum}" fi + } addBlobOnChecksumChange src/github.com/k3s-io/k3s/k3s k3s/k3s @@ -26,3 +31,7 @@ chmod ugo+x src/github.com/kubernetes/kubectl/kubectl addBlobOnChecksumChange src/github.com/kubernetes/kubectl/kubectl kubectl/kubectl +if [ "${NEW_BLOBS_WERE_ADDED}" == "true" ] ; then + # See https://bosh.io/docs/release-blobs/#saving-blobs + bosh upload-blobs +fi \ No newline at end of file