From f8da2f4a9894e291595a862a6d90c3b2e5187edc Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Mon, 27 Jun 2022 00:12:17 +0500 Subject: [PATCH] Add proper FAIL state logging and fix registry variable. --- mirror.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/mirror.sh b/mirror.sh index 077a7d4..8216848 100755 --- a/mirror.sh +++ b/mirror.sh @@ -23,7 +23,7 @@ function mirror() { echo -n "Mirroring ${image}... " if ! docker pull "${image}" &> /dev/null; then - echo "FAIL" + echo "PULL FAILED" exit 1 fi @@ -31,26 +31,22 @@ function mirror() { echo -n "${image_hash} received... " if ! docker tag "${image_hash}" "${DESTINATION_REGISTRY}/${image}" &> /dev/null; then - echo "FAIL" + echo "TAGGING FAILED" exit 1 fi echo -n "pushing... " - if ! docker push "${REGISTRY_TO_MIRROR}/${image}" &> /dev/null; then - echo "FAIL" + if ! docker push "${DESTINATION_REGISTRY}/${image}" &> /dev/null; then + echo "FAILED" exit 1 fi echo "OK" docker image rm "${image}" &> /dev/null - docker image rm "${REGISTRY_TO_MIRROR}/${image}" &> /dev/null + docker image rm "${DESTINATION_REGISTRY}/${image}" &> /dev/null } -env -# shellcheck disable=SC2154 -echo "Secret test: ${drone_secret} or ${PASSWORD}" - # Login to registry. docker login -u "${USER}" -p "${PASSWORD}" "${DESTINATION_REGISTRY}"