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