From 97d0538946a31b36a76c1cf0422542e0f5cf27e2 Mon Sep 17 00:00:00 2001 From: Kai Lueke Date: Thu, 2 Oct 2025 23:26:30 +0900 Subject: [PATCH] ci-automation/release.sh: Fix upload to R2 The upload to R2 was added experimentally and we now want to make use of it. The CHANNEL variable wasn't defined and it failed because of that. Do the upload for all channels and set the variable up first. Existing releases should get synced from the current Origin server via a FUSE mount that we anyway want to rely on for the directory listing that Caddy creates. Left to decide is how we manage the "current" version but that is done manually anyway as of now. Signed-off-by: Kai Lueke --- ci-automation/release.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/ci-automation/release.sh b/ci-automation/release.sh index 6f327bc584..e362fd0136 100644 --- a/ci-automation/release.sh +++ b/ci-automation/release.sh @@ -164,9 +164,20 @@ function copy_from_bincache_to_bucket() { local arch="${2}" local version="${3}" + echo "Experimental (i.e ignore if it fails) - copy the images to CloudFlare bucket" + ( + set +eu rclone --config "${RCLONE_CONFIGURATION_FILE}" \ sync \ - --http-url "https://${BUILDCACHE_SERVER}/images/${arch}/${version}" :http: "r2:flatcar/${channel}/${arch}/${version}" + --http-url "https://${BUILDCACHE_SERVER}/images/${arch}/${version}" :http: "r2:flatcar/${channel}/${arch}-usr/${version}" + # Exit the function cleanly for now: + true + ) + # Note: There is no "current" symlink and when switching the release to current we + # could at a later stage (when the update payloads are selected in Nebraska) either + # use folder copies where we delete the old "current" folder first, or we could + # use a clever Caddy redirect to make "current" point to the wanted version for + # each channel. } function publish_sdk() { @@ -206,6 +217,8 @@ function _release_build_impl() { local vernum="${FLATCAR_VERSION}" local docker_vernum="" docker_vernum="$(vernum_to_docker_image_version "${vernum}")" + local channel= + channel="$(get_git_channel)" local container_name="flatcar-publish-${docker_vernum}" local mantle_ref @@ -222,6 +235,7 @@ function _release_build_impl() { create_digests "${SIGNER}" "aws-${arch}/flatcar_production_ami_"*txt "aws-${arch}/flatcar_production_ami_"*json sign_artifacts "${SIGNER}" "aws-${arch}/flatcar_production_ami_"*txt "aws-${arch}/flatcar_production_ami_"*json copy_to_buildcache "images/${arch}/${vernum}/" "aws-${arch}/flatcar_production_ami_"*txt* "aws-${arch}/flatcar_production_ami_"*json* + copy_from_bincache_to_bucket "${channel}" "${arch}" "${vernum}" done if [ "${vernum}" = "${sdk_version}" ]; then publish_sdk "${docker_sdk_vernum}" @@ -230,9 +244,6 @@ function _release_build_impl() { echo "Done, now you can copy the images to Origin" echo "====" - echo "Experimental (i.e ignore if it fails) - copy the images to CloudFlare bucket for Alpha channel" - [[ "${CHANNEL}" != "alpha" ]] && exit 0 - copy_from_bincache_to_bucket "${CHANNEL}" "${arch}" "${vernum}" # Future: trigger copy to Origin in a secure way # Future: trigger update payload signing