From 6cc449260757fbe1c921e4714cf2ad0a12e65753 Mon Sep 17 00:00:00 2001 From: Tony Hutter Date: Thu, 4 Jun 2026 17:52:36 -0700 Subject: [PATCH] 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 Signed-off-by: Tony Hutter Closes #18628 --- .github/workflows/scripts/qemu-2-start.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/scripts/qemu-2-start.sh b/.github/workflows/scripts/qemu-2-start.sh index 9770c8903cc..7e72030adb9 100755 --- a/.github/workflows/scripts/qemu-2-start.sh +++ b/.github/workflows/scripts/qemu-2-start.sh @@ -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