This commit is contained in:
parent
ce7044456e
commit
62c2dbf194
@ -25,6 +25,9 @@ steps:
|
||||
- name: "mirror"
|
||||
image: "docker:20.10.17-dind"
|
||||
pull: if-not-exists
|
||||
environment:
|
||||
REGISTRY_SECRET:
|
||||
from_secret: drone_secret
|
||||
commands:
|
||||
- apk add --no-cache bash
|
||||
- ./mirror.sh drone ${drone_secret}
|
||||
- ./mirror.sh drone ${REGISTRY_SECRET}
|
||||
|
@ -24,7 +24,7 @@ function mirror() {
|
||||
echo -n "Mirroring ${image}... "
|
||||
if ! docker pull "${image}" &> /dev/null; then
|
||||
echo "FAIL"
|
||||
exit
|
||||
exit 1
|
||||
fi
|
||||
|
||||
image_hash=$(docker images -a | grep "^${image_name}" | grep "${image_version}" | awk "{' print $3 '}")
|
||||
@ -32,13 +32,13 @@ function mirror() {
|
||||
|
||||
if ! docker tag "${image_hash}" "${DESTINATION_REGISTRY}/${image}" &> /dev/null; then
|
||||
echo "FAIL"
|
||||
exit
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -n "pushing... "
|
||||
if ! docker push "${REGISTRY_TO_MIRROR}/${image}" &> /dev/null; then
|
||||
echo "FAIL"
|
||||
exit
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "OK"
|
||||
|
Loading…
Reference in New Issue
Block a user