Fix openSUSE images and bump them to 15.3

SUSE dropped OpenStack Cloud in 2019 [1], and as a result, some
OpenStack-related repositories were removed from openSUSE Download and
root filesystem images stopped being provided. This change deprecates
Leap releases before 15.3 and employs the extract-image script. It also
moves the extract-image script to the sysprep element, since now it's
also used by openSUSE-related elements.

Additionally, revert the "Remove opensuse related funtests" change [2]
so that the opensuse element is tested again and set the default Leap
release to 15.3.

[1] https://www.zdnet.com/article/suse-drops-openstacks/
[2] https://review.opendev.org/c/openstack/diskimage-builder/+/824002

Change-Id: I73d6323aa65cee69a55e54bc53ed682f096dfc89
This commit is contained in:
Eduardo Santos 2022-01-19 13:39:13 -03:00
parent 9c5f5a56d4
commit 0f430664a2
10 changed files with 28 additions and 33 deletions

View File

@ -27,6 +27,7 @@
- centos/8-stream-build-succeeds
- centos/9-stream-build-succeeds
- fedora/build-succeeds
- opensuse/build-succeeds
- ubuntu/bionic-build-succeeds
- ubuntu/focal-build-succeeds

View File

@ -14,12 +14,12 @@ Environment Variables
DIB_RELEASE
:Required: No
:Default: 15.1
:Default: 15.3
:Description: Set the desired openSUSE release.
DIB_CLOUD_IMAGES
:Required: No
:Default: https://download.opensuse.org/repositories/Cloud:/Images:/(openSUSE|Leap)_${DIB_RELEASE}
:Default: https://download.opensuse.org/repositories/Cloud:/Images:/Leap_${DIB_RELEASE}
:Description: Set the desired URL to fetch the images from.
Notes:

View File

@ -1,13 +1,10 @@
export DISTRO_NAME=opensuse
export DIB_RELEASE=${DIB_RELEASE:-15.1}
export DIB_RELEASE=${DIB_RELEASE:-15.3}
export EFI_BOOT_DIR="EFI/opensuse"
export DIB_OPENSUSE_PATTERNS=patterns-openSUSE-base
export DIB_INIT_SYSTEM=systemd
case ${DIB_RELEASE} in
# Old Leap releases
42*) export OPENSUSE_REPO_DIR=openSUSE_Leap_${DIB_RELEASE} ;;
# New Leap releases
15*) export OPENSUSE_REPO_DIR=openSUSE_Leap_${DIB_RELEASE} ;;
15.3) export OPENSUSE_REPO_DIR=openSUSE_Leap_${DIB_RELEASE} ;;
*) echo "Unsupported openSUSE release: ${DIB_RELEASE}"; exit 1 ;;
esac

View File

@ -19,26 +19,14 @@ if ! [ 'x86_64' = "$ARCH" ] ; then
fi
# Set some image defaults
case ${DIB_RELEASE} in
# Old Leap releases
42*)
OPENSUSE_IMAGE_BASEDIR=Leap
OPENSUSE_IMAGE_FILE=openSUSE-Leap-${DIB_RELEASE}-OpenStack
OPENSUSE_IMAGE_EXT=tbz
;;
# New Leap releases
15*)
OPENSUSE_IMAGE_BASEDIR=Leap
OPENSUSE_IMAGE_FILE=openSUSE-Leap-${DIB_RELEASE}-OpenStack
OPENSUSE_IMAGE_EXT=tar.xz
;;
# We handle unknown cases in environment.d/10-opensuse-distro-name.bash
esac
OPENSUSE_IMAGE_BASEDIR=Leap
OPENSUSE_IMAGE_FILE=openSUSE-Leap-${DIB_RELEASE}
OPENSUSE_IMAGE_EXT=qcow2
# NOTE(toabctl): if something changes here on the buildservice side, please
# first ask in #opensuse-cloud on Libera Chat before you change the format
# here!
# first ask in #opensuse-buildservice on Libera Chat before you change the
# format here!
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://download.opensuse.org/repositories/Cloud:/Images:/${OPENSUSE_IMAGE_BASEDIR}_${DIB_RELEASE}/images/}
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-${OPENSUSE_IMAGE_FILE}-rootfs.${ARCH}.${OPENSUSE_IMAGE_EXT}}
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-${OPENSUSE_IMAGE_FILE}.${ARCH}-NoCloud.${OPENSUSE_IMAGE_EXT}}
SHA256SUMS_FILE=${SHA256SUMS_FILE:-${BASE_IMAGE_FILE}.sha256}
CACHED_FILE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
@ -49,17 +37,16 @@ CACHED_SHA256SUMS_FILE=$DIB_IMAGE_CACHE/SHA256SUMS.$BASE_IMAGE_FILE
# over HTTP
if [ -n "$DIB_OFFLINE" -a -f "$CACHED_FILE" ] ; then
echo "Not checking freshness of cached $CACHED_FILE."
# Extract the base image (use --numeric-owner to avoid UID/GID mismatch
# between image tarball and host OS)
sudo tar -C $TARGET_ROOT --numeric-owner -xf $CACHED_FILE
else
echo "Fetching Base Image"
$TMP_HOOKS_PATH/bin/cache-url $DIB_CLOUD_IMAGES/$SHA256SUMS_FILE $CACHED_SHA256SUMS_FILE
$TMP_HOOKS_PATH/bin/cache-url $DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE $CACHED_FILE
$TMP_HOOKS_PATH/bin/extract-image $BASE_IMAGE_FILE $BASE_IMAGE_FILE.tgz $DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE $CACHED_FILE
pushd $DIB_IMAGE_CACHE
# Calculate sha256sum of downloaded image and check against content from sha256 file
SHA256SUM=$(sha256sum ${BASE_IMAGE_FILE} | cut -d " " -f1)
grep -q $SHA256SUM SHA256SUMS.$BASE_IMAGE_FILE
popd
fi
# Extract the base image (use --numeric-owner to avoid UID/GID mismatch between
# image tarball and host OS)
sudo tar -C $TARGET_ROOT --numeric-owner -xf $CACHED_FILE

View File

@ -1 +1 @@
Verify we can build an openSUSE Leap 15.1 image.
Verify we can build an openSUSE Leap 15.3 image.

View File

@ -1 +1 @@
export DIB_RELEASE=15.1
export DIB_RELEASE=15.3

View File

@ -20,4 +20,4 @@ Distributions which are supported as a target for an image:
- 16.04 ("xenial"), 18.04 ("bionic")
- Gentoo
- openEuler 20.03-LTS-SP1+
- openSUSE Leap 42.3, 15.0, 15.1 and Tumbleweed (opensuse-minimal only)
- openSUSE Leap 15.3 and Tumbleweed (opensuse-minimal only)

View File

@ -0,0 +1,8 @@
---
upgrade:
- |
Bumped the default openSUSE Leap release to 15.3 for the opensuse element.
deprecations:
- |
Dropped support for building openSUSE Leap 42.1, 42.2, 42.3, 15.0, 15.1,
and 15.2, since all of them have already reached end-of-life.

View File

@ -37,6 +37,8 @@ DEFAULT_SKIP_TESTS=(
# These download base images which has shown to be very unreliable
# in the gate. Keep them in a -nv job until we can figure out
# better caching for the images
opensuse/build-succeeds
opensuse/opensuse15-build-succeeds
centos7/build-succeeds
debian/build-succeeds
fedora/build-succeeds