|
1 | 1 | #!/bin/bash
|
2 | 2 |
|
| 3 | +# DO NOT EDIT! Generated by "bootstrap-get-images.sh" |
| 4 | + |
3 | 5 | # This script checks if container images needed for tests (currently
|
4 | 6 | # busybox and Debian 10 "Buster") are available locally, and downloads
|
5 | 7 | # them to testdata directory if not.
|
6 | 8 | #
|
7 | 9 | # The script is self-contained/standalone and is used from a few places
|
8 | 10 | # that need to ensure the images are downloaded. Its output is suitable
|
9 | 11 | # for consumption by shell via eval (see helpers.bash).
|
10 |
| -# |
11 |
| -# XXX: Latest available images are fetched. Theoretically, |
12 |
| -# this can bring some instability in case of a broken image. |
13 |
| -# In this case, images will need to be pinned to a checksum |
14 |
| -# on a per-image and per-architecture basis. |
15 | 12 |
|
16 | 13 | set -e -u -o pipefail
|
17 | 14 |
|
@@ -43,28 +40,126 @@ function get() {
|
43 | 40 | }
|
44 | 41 |
|
45 | 42 | arch=$(go env GOARCH)
|
46 |
| -# Convert from GOARCH to whatever the URLs below are using. |
| 43 | +if [ "$arch" = 'arm' ]; then |
| 44 | + arm=$(go env GOARM) |
| 45 | + : "${arm:=7}" |
| 46 | + arch=${arch}v$arm |
| 47 | +fi |
| 48 | + |
47 | 49 | case $arch in
|
| 50 | +amd64) |
| 51 | + # https://github.com/docker-library/busybox/tree/dist-amd64 |
| 52 | + # https://github.com/docker-library/busybox/tree/31d342ad033e27c18723a516a2274ab39547be27/stable/glibc |
| 53 | + url="https://github.com/docker-library/busybox/raw/31d342ad033e27c18723a516a2274ab39547be27/stable/glibc/busybox.tar.xz" |
| 54 | + ;; |
| 55 | + |
| 56 | +armv5) |
| 57 | + # https://github.com/docker-library/busybox/tree/dist-arm32v5 |
| 58 | + # https://github.com/docker-library/busybox/tree/96ea82ea25565f78b50bd032d5768d64985d6e11/stable/glibc |
| 59 | + url="https://github.com/docker-library/busybox/raw/96ea82ea25565f78b50bd032d5768d64985d6e11/stable/glibc/busybox.tar.xz" |
| 60 | + ;; |
| 61 | + |
| 62 | +armv7) |
| 63 | + # https://github.com/docker-library/busybox/tree/dist-arm32v7 |
| 64 | + # https://github.com/docker-library/busybox/tree/5cb6c347469e86e4468e5e248de751b3598bb577/stable/glibc |
| 65 | + url="https://github.com/docker-library/busybox/raw/5cb6c347469e86e4468e5e248de751b3598bb577/stable/glibc/busybox.tar.xz" |
| 66 | + ;; |
| 67 | + |
48 | 68 | arm64)
|
49 |
| - arch=arm64v8 |
| 69 | + # https://github.com/docker-library/busybox/tree/dist-arm64v8 |
| 70 | + # https://github.com/docker-library/busybox/tree/94c664b5ca464546266bce54be0082874a44c7b2/stable/glibc |
| 71 | + url="https://github.com/docker-library/busybox/raw/94c664b5ca464546266bce54be0082874a44c7b2/stable/glibc/busybox.tar.xz" |
50 | 72 | ;;
|
| 73 | + |
51 | 74 | 386)
|
52 |
| - arch=i386 |
| 75 | + # https://github.com/docker-library/busybox/tree/dist-i386 |
| 76 | + # https://github.com/docker-library/busybox/tree/461a473aef31b7726ea99909a24551bf44565c05/stable/glibc |
| 77 | + url="https://github.com/docker-library/busybox/raw/461a473aef31b7726ea99909a24551bf44565c05/stable/glibc/busybox.tar.xz" |
| 78 | + ;; |
| 79 | + |
| 80 | +mips64le) |
| 81 | + # https://github.com/docker-library/busybox/tree/dist-mips64le |
| 82 | + # https://github.com/docker-library/busybox/tree/47f73f7c735dcd6760a976bfe0012d251b6ef0a9/stable/glibc |
| 83 | + url="https://github.com/docker-library/busybox/raw/47f73f7c735dcd6760a976bfe0012d251b6ef0a9/stable/glibc/busybox.tar.xz" |
| 84 | + ;; |
| 85 | + |
| 86 | +ppc64le) |
| 87 | + # https://github.com/docker-library/busybox/tree/dist-ppc64le |
| 88 | + # https://github.com/docker-library/busybox/tree/9ca13bc214717966383cf97e08606b444b7300e4/stable/glibc |
| 89 | + url="https://github.com/docker-library/busybox/raw/9ca13bc214717966383cf97e08606b444b7300e4/stable/glibc/busybox.tar.xz" |
| 90 | + ;; |
| 91 | + |
| 92 | +s390x) |
| 93 | + # https://github.com/docker-library/busybox/tree/dist-s390x |
| 94 | + # https://github.com/docker-library/busybox/tree/a03814d21bcf97767121bb9422a742ec237a09e2/stable/glibc |
| 95 | + url="https://github.com/docker-library/busybox/raw/a03814d21bcf97767121bb9422a742ec237a09e2/stable/glibc/busybox.tar.xz" |
| 96 | + ;; |
| 97 | + |
| 98 | +*) |
| 99 | + echo >&2 "error: unsupported busybox architecture: $arch" |
| 100 | + exit 1 |
53 | 101 | ;;
|
54 | 102 | esac
|
| 103 | +rootfs="$TESTDATA/busybox-${arch}.tar.xz" |
| 104 | +get "$rootfs" "$url" |
| 105 | +var=busybox_image |
| 106 | +echo "${var^^}=$rootfs" |
| 107 | + |
| 108 | +case $arch in |
| 109 | +amd64) |
| 110 | + # https://github.com/debuerreotype/docker-debian-artifacts/tree/dist-amd64 |
| 111 | + # https://github.com/debuerreotype/docker-debian-artifacts/tree/686d9f6eaada08a754bc7abf6f6184c65c5b378f/buster/slim |
| 112 | + url="https://github.com/debuerreotype/docker-debian-artifacts/raw/686d9f6eaada08a754bc7abf6f6184c65c5b378f/buster/slim/rootfs.tar.xz" |
| 113 | + ;; |
| 114 | + |
| 115 | +armv5) |
| 116 | + # https://github.com/debuerreotype/docker-debian-artifacts/tree/dist-arm32v5 |
| 117 | + # https://github.com/debuerreotype/docker-debian-artifacts/tree/155640b6e2e249dfaeee8795d5de539ef3e49417/buster/slim |
| 118 | + url="https://github.com/debuerreotype/docker-debian-artifacts/raw/155640b6e2e249dfaeee8795d5de539ef3e49417/buster/slim/rootfs.tar.xz" |
| 119 | + ;; |
| 120 | + |
| 121 | +armv7) |
| 122 | + # https://github.com/debuerreotype/docker-debian-artifacts/tree/dist-arm32v7 |
| 123 | + # https://github.com/debuerreotype/docker-debian-artifacts/tree/60ff0c2c6ce9556e5d8a2758dd2b3f3731716a6f/buster/slim |
| 124 | + url="https://github.com/debuerreotype/docker-debian-artifacts/raw/60ff0c2c6ce9556e5d8a2758dd2b3f3731716a6f/buster/slim/rootfs.tar.xz" |
| 125 | + ;; |
55 | 126 |
|
56 |
| -# busybox |
57 |
| -BUSYBOX_IMAGE="$TESTDATA/busybox-${arch}.tar.xz" |
58 |
| -get "$BUSYBOX_IMAGE" \ |
59 |
| - "https://github.com/docker-library/busybox/raw/dist-${arch}/stable/glibc/busybox.tar.xz" |
60 |
| -echo "BUSYBOX_IMAGE=$BUSYBOX_IMAGE" |
61 |
| - |
62 |
| -# debian |
63 |
| -DEBIAN_IMAGE="$TESTDATA/debian-${arch}.tar.xz" |
64 |
| -get "$DEBIAN_IMAGE" \ |
65 |
| - "https://github.com/debuerreotype/docker-debian-artifacts/raw/dist-${arch}/buster/slim/rootfs.tar.xz" |
66 |
| -echo "DEBIAN_IMAGE=$DEBIAN_IMAGE" |
67 |
| - |
68 |
| -# hello-world is local, no need to download. |
69 |
| -HELLO_IMAGE="$TESTDATA/hello-world-${arch}.tar" |
70 |
| -echo "HELLO_IMAGE=$HELLO_IMAGE" |
| 127 | +arm64) |
| 128 | + # https://github.com/debuerreotype/docker-debian-artifacts/tree/dist-arm64v8 |
| 129 | + # https://github.com/debuerreotype/docker-debian-artifacts/tree/2f108af35e22064c848b8628a7cac56192246dba/buster/slim |
| 130 | + url="https://github.com/debuerreotype/docker-debian-artifacts/raw/2f108af35e22064c848b8628a7cac56192246dba/buster/slim/rootfs.tar.xz" |
| 131 | + ;; |
| 132 | + |
| 133 | +386) |
| 134 | + # https://github.com/debuerreotype/docker-debian-artifacts/tree/dist-i386 |
| 135 | + # https://github.com/debuerreotype/docker-debian-artifacts/tree/e4db8aa97f4366e6f27ddbdeaed0773fe0288d47/buster/slim |
| 136 | + url="https://github.com/debuerreotype/docker-debian-artifacts/raw/e4db8aa97f4366e6f27ddbdeaed0773fe0288d47/buster/slim/rootfs.tar.xz" |
| 137 | + ;; |
| 138 | + |
| 139 | +mips64le) |
| 140 | + # https://github.com/debuerreotype/docker-debian-artifacts/tree/dist-mips64le |
| 141 | + # https://github.com/debuerreotype/docker-debian-artifacts/tree/e28cbd76dcfba10446b1722aebb5a996121e3d27/buster/slim |
| 142 | + url="https://github.com/debuerreotype/docker-debian-artifacts/raw/e28cbd76dcfba10446b1722aebb5a996121e3d27/buster/slim/rootfs.tar.xz" |
| 143 | + ;; |
| 144 | + |
| 145 | +ppc64le) |
| 146 | + # https://github.com/debuerreotype/docker-debian-artifacts/tree/dist-ppc64le |
| 147 | + # https://github.com/debuerreotype/docker-debian-artifacts/tree/3ba08903ca3fd48fe59ba92b02744a2f5d4d9d6f/buster/slim |
| 148 | + url="https://github.com/debuerreotype/docker-debian-artifacts/raw/3ba08903ca3fd48fe59ba92b02744a2f5d4d9d6f/buster/slim/rootfs.tar.xz" |
| 149 | + ;; |
| 150 | + |
| 151 | +s390x) |
| 152 | + # https://github.com/debuerreotype/docker-debian-artifacts/tree/dist-s390x |
| 153 | + # https://github.com/debuerreotype/docker-debian-artifacts/tree/2fddbf8fe632fc5865b140341b68a1358586fff2/buster/slim |
| 154 | + url="https://github.com/debuerreotype/docker-debian-artifacts/raw/2fddbf8fe632fc5865b140341b68a1358586fff2/buster/slim/rootfs.tar.xz" |
| 155 | + ;; |
| 156 | + |
| 157 | +*) |
| 158 | + echo >&2 "error: unsupported debian architecture: $arch" |
| 159 | + exit 1 |
| 160 | + ;; |
| 161 | +esac |
| 162 | +rootfs="$TESTDATA/debian-${arch}.tar.xz" |
| 163 | +get "$rootfs" "$url" |
| 164 | +var=debian_image |
| 165 | +echo "${var^^}=$rootfs" |
0 commit comments