Force push for images and proper interruption when pulling images fail.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Stanislav Nikitin 2023-01-01 22:27:47 +05:00
parent edb14e5112
commit 21666b4de3
No known key found for this signature in database
GPG Key ID: 9A63857413C83B4A
2 changed files with 9 additions and 4 deletions

View File

@ -32,7 +32,6 @@ steps:
REGISTRY_USERNAME: drone REGISTRY_USERNAME: drone
REGISTRY_PASSWORD: REGISTRY_PASSWORD:
from_secret: drone_secret from_secret: drone_secret
DOCKER_MAX_CONCURRENT_UPLOADS: 1
commands: commands:
- apk add --no-cache bash - apk add --no-cache bash
- ./mirror.sh - ./mirror.sh

View File

@ -135,6 +135,8 @@ function mirror() {
# We presumes that amd64 image should always be available. # We presumes that amd64 image should always be available.
if ! get_amd64_image "${image}"; then if ! get_amd64_image "${image}"; then
echo "! Image mirroring failed! Cannot obtain amd64 image!" echo "! Image mirroring failed! Cannot obtain amd64 image!"
return 1
fi fi
get_arm64_image "${image}" get_arm64_image "${image}"
@ -145,13 +147,13 @@ function mirror() {
function push_multiarch_image() { function push_multiarch_image() {
local image=$1 local image=$1
if ! docker push "${REMOTE_IMAGE}"-amd64 &> /dev/null; then if ! docker push -f "${REMOTE_IMAGE}"-amd64 &> /dev/null; then
echo -e "\t! amd64 image push failed!" echo -e "\t! amd64 image push failed!"
else else
echo -e "\t* amd64 image pushed" echo -e "\t* amd64 image pushed"
fi fi
if ! docker push "${REMOTE_IMAGE}"-arm64 &> /dev/null; then if ! docker push -f ="${REMOTE_IMAGE}"-arm64 &> /dev/null; then
echo -e "\t! arm64 image push failed!" echo -e "\t! arm64 image push failed!"
else else
echo -e "\t* arm64 image pushed" echo -e "\t* arm64 image pushed"
@ -186,5 +188,9 @@ login_to_registry
collect_images collect_images
for package in "${WHAT_TO_MIRROR[@]}"; do for package in "${WHAT_TO_MIRROR[@]}"; do
mirror "${package}" if ! mirror "${package}"; then
echo "! Failed to mirror package ${package}!"
exit 1
fi
done done