Merge "Auto find greatest Fedora cloud image sub-release"

This commit is contained in:
Zuul 2021-07-22 07:53:44 +00:00 committed by Gerrit Code Review
commit 02bda20dce
2 changed files with 3 additions and 26 deletions

View File

@ -2,27 +2,3 @@ export DISTRO_NAME=fedora
export DIB_RELEASE=${DIB_RELEASE:-32} export DIB_RELEASE=${DIB_RELEASE:-32}
export EFI_BOOT_DIR="EFI/fedora" export EFI_BOOT_DIR="EFI/fedora"
# Note the filename URL has a "sub-release" in it
# http:// ... Fedora-Cloud-Base-25-1.3.x86_64.qcow2
# ^^^
# It's not exactly clear how this is generated, or how we could
# determine this programatically. Other projects have more
# complicated regex-based scripts to find this, which we can examine
# if this becomes an issue ... see thread at [1]
#
# [1] https://lists.fedoraproject.org/archives/list/cloud@lists.fedoraproject.org/thread/2WFO2FKIGUQYRQXIR35UVJGRHF7LQENJ/
if [[ ${DIB_RELEASE} == '28' ]]; then
export DIB_FEDORA_SUBRELEASE=1.1
elif [[ ${DIB_RELEASE} == '29' ]]; then
export DIB_FEDORA_SUBRELEASE=1.2
elif [[ ${DIB_RELEASE} == '30' ]]; then
export DIB_FEDORA_SUBRELEASE=1.2
elif [[ ${DIB_RELEASE} == '31' ]]; then
export DIB_FEDORA_SUBRELEASE=1.9
elif [[ ${DIB_RELEASE} == '32' ]]; then
export DIB_FEDORA_SUBRELEASE=1.6
else
echo "Unsupported Fedora release"
exit 1
fi

View File

@ -44,8 +44,9 @@ else
exit 1 exit 1
;; ;;
esac esac
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-Fedora-Cloud-Base-$DIB_RELEASE-$DIB_FEDORA_SUBRELEASE.$ARCH.qcow2} SUBRELEASE=$(curl -Ls $DIB_CLOUD_IMAGES/ | grep -o -P '(?<=Fedora-Cloud-Base-'${DIB_RELEASE}'-).*(?=.'${ARCH}'.qcow2")' | sort -r | head -1)
BASE_IMAGE_TAR=Fedora-Cloud-Base-$DIB_RELEASE-$DIB_FEDORA_SUBRELEASE.$ARCH.tgz BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-Fedora-Cloud-Base-$DIB_RELEASE-$SUBRELEASE.$ARCH.qcow2}
BASE_IMAGE_TAR=Fedora-Cloud-Base-$DIB_RELEASE-$SUBRELEASE.$ARCH.tgz
IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE
CACHED_IMAGE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE CACHED_IMAGE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
fi fi