1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#!/usr/bin/env bash
# Fetch images used for e2e testing
set -eu -o pipefail
alpine_src=alpine@sha256:69665d02cb32192e52e07644d76bc6f25abeb5410edc1c7a81a10ba3f0efb90a
alpine_dest=registry:5000/alpine:frozen
busybox_src=busybox@sha256:3e8fa85ddfef1af9ca85a5cfb714148956984e02f00bec3f7f49d3925a91e0e7
busybox_dest=registry:5000/busybox:frozen
fetch_tag_image() {
docker pull "$1"
docker tag "$1" "$2"
}
push_image() {
docker push "$1"
}
cmd=${1-}
case "$cmd" in
alpine)
fetch_tag_image "$alpine_src" "$alpine_dest"
push_image "$alpine_dest"
exit
;;
busybox)
fetch_tag_image "$busybox_src" "$busybox_dest"
push_image "$busybox_dest"
exit
;;
all|"")
fetch_tag_image "$alpine_src" "$alpine_dest"
push_image "$alpine_dest"
fetch_tag_image "$busybox_src" "$busybox_dest"
push_image "$busybox_dest"
exit
;;
fetch-only)
fetch_tag_image "$alpine_src" "$alpine_dest"
fetch_tag_image "$busybox_src" "$busybox_dest"
exit
;;
*)
echo "Unknown command: $cmd"
echo "Usage:"
echo " $0 [alpine | busybox | all | fetch-only]"
exit 1
;;
esac
|