1
0
Files
rngpotd/.ci/sync-latest.sh
Konstantin Demin 4d7da179dd
Some checks failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/manual/latest Pipeline failed
ci: try to resolve network issues
2025-07-17 13:34:53 +03:00

38 lines
720 B
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: Apache-2.0
# (c) 2024-2025, Konstantin Demin
set -ef
[ -z "${CI_DEBUG}" ] || set -xv
: "${IMAGE_NAME:?}" "${LATEST_TAG:?}"
. .ci/envsh.registry
image_src="docker://${IMAGE_NAME}"
oci_dir="${PWD}/oci-layers"
image_interim="oci:${oci_dir}:$(basename "${IMAGE_NAME}"):${LATEST_TAG}"
rm -rf "${oci_dir}" ; mkdir "${oci_dir}"
r=0
img_copy() {
skopeo copy --retry 7 --retry-delay 60s --all "$@"
}
while : ; do
img_copy "${image_src}:${LATEST_TAG}" "${image_interim}" || r=$?
[ "$r" = 0 ] || break
echo " -> ${image_src}:latest"
img_copy "${image_interim}" "${image_src}:latest" || r=$?
[ "$r" = 0 ] || break
break
done
rm -rf "${oci_dir}"
exit "$r"