ci/release: copy secondary artifacts from bincache

this logic takes care of copying binary packages, SDK and packages
containers to cloudflare bucket in the `r2:flatcar/mirror/` location

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
This commit is contained in:
Mathieu Tortuyaux 2025-11-12 10:54:30 +01:00
parent dfa08dae96
commit d6e9bfe9c5
No known key found for this signature in database
GPG Key ID: AC5CCFB52545D9B8

View File

@ -175,7 +175,27 @@ function copy_from_bincache_to_bucket() {
docker.io/rclone/rclone:1.71.1 \
--config "/opt/rclone.conf" \
sync \
--http-url "https://${BUILDCACHE_SERVER}/images/${arch}/${version}" :http: "r2:flatcar/${channel}/${arch}-usr/${version}" || { echo "ERROR: Skipping bucket copy due to failure" ; }
--http-url "https://${BUILDCACHE_SERVER}/images/${arch}/${version}" :http: "r2:flatcar/${channel}/${arch}-usr/${version}" || { echo "ERROR: Skipping images copy to bucket due to failure" ; }
echo "Copying the binary packages from bincache to CloudFlare bucket"
docker run --rm --net host \
-v "${rclone_configuration_file}:/opt/rclone.conf:ro" \
docker.io/rclone/rclone:1.71.1 \
--config "/opt/rclone.conf" \
sync \
--http-url "https://${BUILDCACHE_SERVER}/boards/${arch}-usr/${version}" :http: "r2:flatcar/mirror/boards/${arch}-usr/${version}" || { echo "ERROR: Skipping binary packages copy to bucket due to failure" ; }
# Only copy once the 'containers' artifacts
if [ "${arch}" = "amd64" ]; then
echo "Copying SDK and packages containers from bincache to CloudFlare bucket"
docker run --rm --net host \
-v "${rclone_configuration_file}:/opt/rclone.conf:ro" \
docker.io/rclone/rclone:1.71.1 \
--config "/opt/rclone.conf" \
sync \
--http-url "https://${BUILDCACHE_SERVER}/containers/${version}" :http: "r2:flatcar/mirror/containers/${version}" || { echo "ERROR: Skipping containers copy (SDK / packages) to bucket due to failure" ; }
fi
)
}
@ -200,6 +220,22 @@ function publish_sdk() {
docker_image_from_registry_or_buildcache "${sdk_name}" "${docker_sdk_vernum}"
docker push "${sdk_container_common_registry}/flatcar-sdk-${a}:${docker_sdk_vernum}"
done
rclone_configuration_file="$(mktemp)"
chmod 600 "${rclone_configuration_file}"
(
trap "rm -f ${rclone_configuration_file}" EXIT
echo "${RCLONE_CONFIGURATION_FILE}" | base64 --decode > "${rclone_configuration_file}"
echo "Copying the SDK from bincache to CloudFlare bucket"
docker run --rm --net host \
-v "${rclone_configuration_file}:/opt/rclone.conf:ro" \
docker.io/rclone/rclone:1.71.1 \
--config "/opt/rclone.conf" \
sync \
--http-url "https://${BUILDCACHE_SERVER}/sdk/amd64/${docker_sdk_vernum}" :http: "r2:flatcar/mirror/sdk/amd64/${docker_sdk_vernum}" || { echo "ERROR: Skipping SDK copy to bucket due to failure" ; }
)
}
function _release_build_impl() {