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 <kailuke@microsoft.com>
This commit is contained in:
Kai Lueke 2025-10-02 23:26:30 +09:00
parent 119ae89545
commit 97d0538946

View File

@ -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