github.com/panekj/cli@v0.0.0-20230304125325-467dd2f3797e/scripts/test/e2e/load-image (about)

     1  #!/usr/bin/env bash
     2  # Fetch images used for e2e testing
     3  set -eu -o pipefail
     4  
     5  alpine_src=alpine@sha256:f006ecbb824d87947d0b51ab8488634bf69fe4094959d935c0c103f4820a417d
     6  alpine_dest=registry:5000/alpine:3.6
     7  
     8  busybox_src=busybox@sha256:3e8fa85ddfef1af9ca85a5cfb714148956984e02f00bec3f7f49d3925a91e0e7
     9  busybox_dest=registry:5000/busybox:1.27.2
    10  
    11  fetch_tag_image() {
    12      docker pull "$1"
    13      docker tag "$1" "$2"
    14  }
    15  
    16  push_image() {
    17    docker push "$1"
    18  }
    19  
    20  cmd=${1-}
    21  case "$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          ;;
    50  esac