Fix mirror script logging in to registry.
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
7173cab2ba
commit
49ece50d05
11
mirror.sh
11
mirror.sh
@ -3,7 +3,8 @@
|
||||
# The Docker Image Mirror script.
|
||||
|
||||
WHAT_TO_MIRROR=()
|
||||
DESTINATION_REGISTRY=code.pztrn.name/containers/mirror
|
||||
DESTINATION_REGISTRY=code.pztrn.name
|
||||
DESTINATION_PROJECT=${DESTINATION_REGISTRY}/containers/mirror
|
||||
USER=${REGISTRY_USER}
|
||||
PASSWORD=${REGISTRY_PASSWORD}
|
||||
|
||||
@ -30,15 +31,15 @@ function mirror() {
|
||||
|
||||
# shellcheck disable=SC1083
|
||||
image_hash=$(docker images -a | grep "^${image_name}" | grep "${image_version}" | awk {' print $3 '})
|
||||
echo -n "${image_hash} received, retag as '${DESTINATION_REGISTRY}/${image}'... "
|
||||
echo -n "${image_hash} received, retag as '${DESTINATION_PROJECT}/${image}'... "
|
||||
|
||||
if ! docker tag "${image_hash}" "${DESTINATION_REGISTRY}/${image}" &>/dev/null; then
|
||||
if ! docker tag "${image_hash}" "${DESTINATION_PROJECT}/${image}" &>/dev/null; then
|
||||
echo "TAGGING FAILED"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -n "pushing... "
|
||||
if ! docker push "${DESTINATION_REGISTRY}/${image}" &>/dev/null; then
|
||||
if ! docker push "${DESTINATION_PROJECT}/${image}" &>/dev/null; then
|
||||
echo "FAILED"
|
||||
exit 1
|
||||
fi
|
||||
@ -46,7 +47,7 @@ function mirror() {
|
||||
echo "OK"
|
||||
|
||||
docker image rm "${image}" &>/dev/null
|
||||
docker image rm "${DESTINATION_REGISTRY}/${image}" &>/dev/null
|
||||
docker image rm "${DESTINATION_PROJECT}/${image}" &>/dev/null
|
||||
}
|
||||
|
||||
# Login to registry.
|
||||
|
Loading…
Reference in New Issue
Block a user