From 1f9619cdb5fe7c2eab91b16fe3b78dc97ed279cf Mon Sep 17 00:00:00 2001 From: Carlos Goncalves Date: Mon, 22 Jun 2020 10:55:32 +0200 Subject: [PATCH] Download latest CentOS cloud image DIB was retrieving the oldest cloud image file which, presently, means retrieving CentOS 8.1 instead of CentOS 8.2. Even though DIB runs a system update and so catches up to latest, this takes bandwidth, time and final image space (8.1 + system update = 765M qcow2, vs 8.2 + system update = 518M qcow2). This patch fixes that by taking the first image name in a descending order list. Change-Id: I648fe19f1f76c03c97492b6ac7be6381f6f9261b --- diskimage_builder/elements/centos/root.d/10-centos-cloud-image | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diskimage_builder/elements/centos/root.d/10-centos-cloud-image b/diskimage_builder/elements/centos/root.d/10-centos-cloud-image index 19b8d04d..88f4111e 100755 --- a/diskimage_builder/elements/centos/root.d/10-centos-cloud-image +++ b/diskimage_builder/elements/centos/root.d/10-centos-cloud-image @@ -51,7 +51,7 @@ else if [[ "${DIB_RELEASE}" = 7 ]]; then BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-CentOS-${DIB_RELEASE}-${ARCH}-${DIB_FLAVOR}.qcow2.xz} else - LATEST_IMAGE_FILE=$(curl -s https://cloud.centos.org/centos/${DIB_RELEASE}/${ARCH}/images/ | grep -o "CentOS-${DIB_RELEASE}-${DIB_FLAVOR}-.[^>]*.qcow2" | head -1) + LATEST_IMAGE_FILE=$(curl -s https://cloud.centos.org/centos/${DIB_RELEASE}/${ARCH}/images/ | grep -o "CentOS-${DIB_RELEASE}-${DIB_FLAVOR}-.[^>]*.qcow2" | sort -r | head -1) BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$LATEST_IMAGE_FILE} fi BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz