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