This commit is contained in:
parent
62c2dbf194
commit
b66d9c5314
@ -26,8 +26,9 @@ steps:
|
|||||||
image: "docker:20.10.17-dind"
|
image: "docker:20.10.17-dind"
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
environment:
|
environment:
|
||||||
|
REGISTRY_USER: drone
|
||||||
REGISTRY_SECRET:
|
REGISTRY_SECRET:
|
||||||
from_secret: drone_secret
|
from_secret: drone_secret
|
||||||
commands:
|
commands:
|
||||||
- apk add --no-cache bash
|
- apk add --no-cache bash
|
||||||
- ./mirror.sh drone ${REGISTRY_SECRET}
|
- ./mirror.sh
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
WHAT_TO_MIRROR=()
|
WHAT_TO_MIRROR=()
|
||||||
DESTINATION_REGISTRY=code.pztrn.name/containers/mirror
|
DESTINATION_REGISTRY=code.pztrn.name/containers/mirror
|
||||||
REGISTRY_USER=$1
|
USER=${REGISTRY_USER}
|
||||||
REGISTRY_PASSWORD=$2
|
PASSWORD=${REGISTRY_PASSWORD}
|
||||||
|
|
||||||
MIRROR_CONFIGS=$(ls ./images/*.sh)
|
MIRROR_CONFIGS=$(ls ./images/*.sh)
|
||||||
for file in "${MIRROR_CONFIGS[@]}"; do
|
for file in "${MIRROR_CONFIGS[@]}"; do
|
||||||
@ -49,10 +49,10 @@ function mirror() {
|
|||||||
|
|
||||||
env
|
env
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
echo "Secret test: ${drone_secret} or ${REGISTRY_PASSWORD}"
|
echo "Secret test: ${drone_secret} or ${PASSWORD}"
|
||||||
|
|
||||||
# Login to registry.
|
# Login to registry.
|
||||||
docker login -u "${REGISTRY_USER}" -p "${REGISTRY_PASSWORD}" "${DESTINATION_REGISTRY}"
|
docker login -u "${USER}" -p "${PASSWORD}" "${DESTINATION_REGISTRY}"
|
||||||
|
|
||||||
# Mirror images.
|
# Mirror images.
|
||||||
for image in "${WHAT_TO_MIRROR[@]}"; do
|
for image in "${WHAT_TO_MIRROR[@]}"; do
|
||||||
|
Loading…
Reference in New Issue
Block a user