CI: Add alternative URLs for CentOS stream
Fallback to trying the "CentOS Strean Composes" repo for the qcow2 images if the regular URLs fail. The Composes repo contains the daily autobuilt Stream images. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Tony Hutter <hutter2@llnl.gov> Closes #18628
This commit is contained in:
@@ -28,6 +28,7 @@ NIC="virtio"
|
||||
# additional options for virt-install
|
||||
OPTS[0]=""
|
||||
OPTS[1]=""
|
||||
ALT_URL=""
|
||||
|
||||
case "$OS" in
|
||||
almalinux8)
|
||||
@@ -56,11 +57,22 @@ case "$OS" in
|
||||
centos-stream9)
|
||||
OSNAME="CentOS Stream 9"
|
||||
URL="https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-latest.x86_64.qcow2"
|
||||
|
||||
# Sometimes we get HTTP errors for the first link. Fall back to the
|
||||
# "Composes" repo as an alternative. The "Composes" repo includes
|
||||
# autogenerated nightly CentOS Stream images. We have to lookup the URL
|
||||
# dynamically since the qcow2 file name has the date in it.
|
||||
ALT_URL=$(wget --accept "CentOS-Stream-GenericCloud-9-*.x86_64.qcow2" --spider -np --recursive --no-verbose \
|
||||
https://composes.stream.centos.org/stream-9/production/latest-CentOS-Stream/compose/BaseOS/x86_64/images/ 2>&1 | \
|
||||
awk '/200 OK/{print $(NF-2)}')
|
||||
;;
|
||||
centos-stream10)
|
||||
OSNAME="CentOS Stream 10"
|
||||
OSv="centos-stream9"
|
||||
URL="https://cloud.centos.org/centos/10-stream/x86_64/images/CentOS-Stream-GenericCloud-10-latest.x86_64.qcow2"
|
||||
ALT_URL=$(wget --accept "CentOS-Stream-GenericCloud-10-*.x86_64.qcow2" --spider -np --recursive --no-verbose \
|
||||
https://composes.stream.centos.org/stream-10/production/latest-CentOS-Stream/compose/BaseOS/x86_64/images/ 2>&1 | \
|
||||
awk '/200 OK/{print $(NF-2)}')
|
||||
;;
|
||||
debian11)
|
||||
OSNAME="Debian 11"
|
||||
@@ -204,6 +216,16 @@ for cmd in 'axel -q -o' 'curl --fail -LSs -o' ; do
|
||||
if [ -s "$IMG" ] ; then
|
||||
# Successful download
|
||||
break
|
||||
else
|
||||
if [ -n "$ALT_URL" ] ; then
|
||||
# Try the $ALT_URL if specified
|
||||
echo "Loading alternative $ALT_URL with $cmd..."
|
||||
time eval "$cmd $IMG $ALT_URL"
|
||||
if [ -s "$IMG" ]; then
|
||||
# Successful ALT_URL download
|
||||
break
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user