Add CentOS 8 support
* Add "centos" element, a CentOS version-independent element. This is in line with the same work done for RHEL in Stein cycle. * Deprecate the centos7 element. CentOS 7 support itself it not deprecated though. The new "centos" element provides the same support level as the "centos7" element. * Add functional testing The default CentOS version is 8. You can adjust it using the DIB_RELEASE environment variable. Change-Id: I373ba2296c4613765676e59aabd9c651345298d1
This commit is contained in:
parent
9d08848f25
commit
8226384cf0
@ -42,6 +42,7 @@
|
|||||||
vars:
|
vars:
|
||||||
dib_functests:
|
dib_functests:
|
||||||
- centos7/build-succeeds
|
- centos7/build-succeeds
|
||||||
|
- centos/8-build-succeeds
|
||||||
- opensuse/build-succeeds
|
- opensuse/build-succeeds
|
||||||
- opensuse/opensuse15-build-succeeds
|
- opensuse/opensuse15-build-succeeds
|
||||||
- fedora/build-succeeds
|
- fedora/build-succeeds
|
||||||
|
26
diskimage_builder/elements/centos/README.rst
Normal file
26
diskimage_builder/elements/centos/README.rst
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
======
|
||||||
|
centos
|
||||||
|
======
|
||||||
|
|
||||||
|
Use CentOS cloud images as the baseline for built disk images.
|
||||||
|
|
||||||
|
For further details see the redhat-common README.
|
||||||
|
|
||||||
|
Environment Variables
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
DIB_DISTRIBUTION_MIRROR:
|
||||||
|
:Required: No
|
||||||
|
:Default: None
|
||||||
|
:Description: To use a CentOS Yum mirror, set this variable to the mirror URL
|
||||||
|
before running bin/disk-image-create. This URL should point to
|
||||||
|
the directory containing the ``7/8`` directories.
|
||||||
|
:Example: ``DIB_DISTRIBUTION_MIRROR=http://amirror.com/centos``
|
||||||
|
|
||||||
|
DIB_CLOUD_IMAGES:
|
||||||
|
:Required: No
|
||||||
|
:Description: Set the desired URL to fetch the images from. ppc64le:
|
||||||
|
Currently the CentOS community is working on providing the
|
||||||
|
ppc64le images. Until then you'll need to set this to a local
|
||||||
|
image file.
|
||||||
|
:Example: ``DIB_CLOUD_IMAGES=/path/to/my/centos/8/CentOS-8-GenericCloud-x86_64.qcow2``
|
5
diskimage_builder/elements/centos/element-deps
Normal file
5
diskimage_builder/elements/centos/element-deps
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
cache-url
|
||||||
|
redhat-common
|
||||||
|
rpm-distro
|
||||||
|
source-repositories
|
||||||
|
yum
|
@ -0,0 +1,2 @@
|
|||||||
|
export DISTRO_NAME=centos
|
||||||
|
export DIB_RELEASE=${DIB_RELEASE:-8}
|
@ -0,0 +1,7 @@
|
|||||||
|
# since CentOS 8, dnf is the yum replacement.
|
||||||
|
|
||||||
|
if [[ ${DIB_RELEASE} == '8' ]]; then
|
||||||
|
export YUM=dnf
|
||||||
|
elif [[ ${DIB_RELEASE} == '7' ]]; then
|
||||||
|
export YUM=yum
|
||||||
|
fi
|
23
diskimage_builder/elements/centos/pre-install.d/01-set-centos-mirror
Executable file
23
diskimage_builder/elements/centos/pre-install.d/01-set-centos-mirror
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
set -eu
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-}
|
||||||
|
|
||||||
|
[ -n "$DIB_DISTRIBUTION_MIRROR" ] || exit 0
|
||||||
|
|
||||||
|
# Only set the mirror for the Base, Extras and Updates repositories
|
||||||
|
# The others aren't enabled and do not exist on all mirrors
|
||||||
|
if [[ ${DIB_RELEASE} == '7' ]]; then
|
||||||
|
sed -e "s|^#baseurl=http[s]*://mirror.centos.org/centos|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Base.repo
|
||||||
|
elif [[ ${DIB_RELEASE} == '8' ]]; then
|
||||||
|
sed -e "s|^#baseurl=http[s]*://mirror.centos.org/|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Base.repo
|
||||||
|
sed -e "s|^#baseurl=http[s]*://mirror.centos.org/|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-AppStream.repo
|
||||||
|
sed -e "s|^#baseurl=http[s]*://mirror.centos.org/|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-centosplus.repo
|
||||||
|
sed -e "s|^#baseurl=http[s]*://mirror.centos.org/|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Extras.repo
|
||||||
|
sed -e "s|^#baseurl=http[s]*://mirror.centos.org/|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-PowerTools.repo
|
||||||
|
fi
|
23
diskimage_builder/elements/centos/pre-install.d/02-set-machine-id
Executable file
23
diskimage_builder/elements/centos/pre-install.d/02-set-machine-id
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
set -eu
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
# Set a machine-id. The .qcow2 image doesn't have one, and sometimes
|
||||||
|
# one will get made (if systemd is upgraded as part of the build
|
||||||
|
# process) and sometimes not. The problem is that certain kernel
|
||||||
|
# install scripts bail silently without it; kernel packages end up
|
||||||
|
# being installed but the initramfs etc isn't copied into place.
|
||||||
|
#
|
||||||
|
# Note this is cleared out in the sysprep role.
|
||||||
|
#
|
||||||
|
# See also:
|
||||||
|
# 768c5e188c1b4bff01da14a49b96b51301db4c03 : similar thing for fedora
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1737355 : upstream bug
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1486124 : unresolved
|
||||||
|
# bug about kernel install requiring machine-id
|
||||||
|
|
||||||
|
systemd-machine-id-setup
|
62
diskimage_builder/elements/centos/root.d/10-centos-cloud-image
Executable file
62
diskimage_builder/elements/centos/root.d/10-centos-cloud-image
Executable file
@ -0,0 +1,62 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
set -eu
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
[ -n "$ARCH" ]
|
||||||
|
[ -n "$TARGET_ROOT" ]
|
||||||
|
|
||||||
|
if [[ "${DIB_RELEASE}" = 7 ]]; then
|
||||||
|
if [[ "amd64 x86_64" =~ "$ARCH" ]]; then
|
||||||
|
ARCH="x86_64"
|
||||||
|
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/centos/${DIB_RELEASE}/images}
|
||||||
|
elif [[ "arm64 aarch64" =~ "$ARCH" ]]; then
|
||||||
|
ARCH="aarch64"
|
||||||
|
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/altarch/${DIB_RELEASE}/images/aarch64}
|
||||||
|
elif [[ "ppc64le" =~ "$ARCH" ]]; then
|
||||||
|
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/altarch/${DIB_RELEASE}/images/ppc64le}
|
||||||
|
else
|
||||||
|
echo 'centos root element only support the x86_64, aarch64 and ppc64le values for $ARCH'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ "amd64 x86_64 arm64 aarch64 ppc64le" =~ "$ARCH" ]]; then
|
||||||
|
if [[ "amd64" =~ "$ARCH" ]]; then
|
||||||
|
ARCH="x86_64"
|
||||||
|
elif [[ "arm64" =~ "$ARCH" ]]; then
|
||||||
|
ARCH="aarch64"
|
||||||
|
fi
|
||||||
|
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/centos/${DIB_RELEASE}/${ARCH}/images}
|
||||||
|
else
|
||||||
|
echo 'centos root element only support the x86_64, aarch64 and ppc64le values for $ARCH'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
DIB_LOCAL_IMAGE=${DIB_LOCAL_IMAGE:-}
|
||||||
|
|
||||||
|
if [ -n "$DIB_LOCAL_IMAGE" ]; then
|
||||||
|
IMAGE_LOCATION=$DIB_LOCAL_IMAGE
|
||||||
|
# No need to copy a local image into the cache directory, so just specify
|
||||||
|
# the cached path as the original path.
|
||||||
|
CACHED_IMAGE=$IMAGE_LOCATION
|
||||||
|
BASE_IMAGE_FILE=$(basename $DIB_LOCAL_IMAGE)
|
||||||
|
BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz
|
||||||
|
else
|
||||||
|
DIB_FLAVOR=${DIB_FLAVOR:-GenericCloud}
|
||||||
|
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)
|
||||||
|
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$LATEST_IMAGE_FILE}
|
||||||
|
fi
|
||||||
|
BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz
|
||||||
|
IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE
|
||||||
|
CACHED_IMAGE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
$TMP_HOOKS_PATH/bin/extract-image $BASE_IMAGE_FILE $BASE_IMAGE_TAR $IMAGE_LOCATION $CACHED_IMAGE
|
@ -0,0 +1 @@
|
|||||||
|
Centos 8 test
|
@ -0,0 +1,3 @@
|
|||||||
|
base
|
||||||
|
epel
|
||||||
|
openstack-ci-mirrors
|
@ -0,0 +1 @@
|
|||||||
|
export DIB_RELEASE='8'
|
@ -0,0 +1 @@
|
|||||||
|
qcow2
|
@ -1,6 +1,13 @@
|
|||||||
=======
|
=======
|
||||||
centos7
|
centos7
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
This element is deprecated and is left only for backward compatibility.
|
||||||
|
Use the `centos` element instead. Note that you should set DIB_RELEASE to 7
|
||||||
|
to indicate which release you are using. Please read the notes.
|
||||||
|
|
||||||
Use CentOS 7 cloud images as the baseline for built disk images.
|
Use CentOS 7 cloud images as the baseline for built disk images.
|
||||||
|
|
||||||
For further details see the redhat-common README.
|
For further details see the redhat-common README.
|
||||||
|
@ -1,5 +1 @@
|
|||||||
cache-url
|
centos
|
||||||
redhat-common
|
|
||||||
rpm-distro
|
|
||||||
source-repositories
|
|
||||||
yum
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
echo "The centos7 element is deprecated and will be removed in future releases. Use the centos element instead."
|
@ -0,0 +1,7 @@
|
|||||||
|
# For backward compat (centos vs centos7)
|
||||||
|
export DIB_FLAVOR=${DIB_RELEASE:-GenericCloud}
|
||||||
|
export DIB_RELEASE=7
|
||||||
|
|
||||||
|
# Useful for elements that work with fedora (dnf) & centos
|
||||||
|
export YUM=${YUM:-yum}
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
set -eu
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-}
|
|
||||||
|
|
||||||
[ -n "$DIB_DISTRIBUTION_MIRROR" ] || exit 0
|
|
||||||
|
|
||||||
# Only set the mirror for the Base, Extras and Updates repositories
|
|
||||||
# The others arn't enabled and do not exist on all mirrors
|
|
||||||
sed -e "s|^#baseurl=http[s]*://mirror.centos.org/centos|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Base.repo
|
|
@ -1,42 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
set -eu
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
[ -n "$ARCH" ]
|
|
||||||
[ -n "$TARGET_ROOT" ]
|
|
||||||
|
|
||||||
if [[ "amd64 x86_64" =~ "$ARCH" ]]; then
|
|
||||||
ARCH="x86_64"
|
|
||||||
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/centos/7/images}
|
|
||||||
elif [[ "arm64 aarch64" =~ "$ARCH" ]]; then
|
|
||||||
ARCH="aarch64"
|
|
||||||
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/altarch/7/images/aarch64}
|
|
||||||
elif [[ "ppc64le" =~ "$ARCH" ]]; then
|
|
||||||
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/altarch/7/images/ppc64le}
|
|
||||||
else
|
|
||||||
echo 'centos7 root element only support the x86_64, aarch64 and ppc64le values for $ARCH'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
DIB_LOCAL_IMAGE=${DIB_LOCAL_IMAGE:-}
|
|
||||||
|
|
||||||
if [ -n "$DIB_LOCAL_IMAGE" ]; then
|
|
||||||
IMAGE_LOCATION=$DIB_LOCAL_IMAGE
|
|
||||||
# No need to copy a local image into the cache directory, so just specify
|
|
||||||
# the cached path as the original path.
|
|
||||||
CACHED_IMAGE=$IMAGE_LOCATION
|
|
||||||
BASE_IMAGE_FILE=$(basename $DIB_LOCAL_IMAGE)
|
|
||||||
BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz
|
|
||||||
else
|
|
||||||
DIB_CENTOS7_CLOUD_RELEASE=${DIB_CENTOS7_CLOUD_RELEASE:-GenericCloud}
|
|
||||||
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-CentOS-7-${ARCH}-$DIB_CENTOS7_CLOUD_RELEASE.qcow2.xz}
|
|
||||||
BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz
|
|
||||||
IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE
|
|
||||||
CACHED_IMAGE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
|
|
||||||
fi
|
|
||||||
|
|
||||||
$TMP_HOOKS_PATH/bin/extract-image $BASE_IMAGE_FILE $BASE_IMAGE_TAR $IMAGE_LOCATION $CACHED_IMAGE
|
|
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- Added CentOS 8 support.
|
||||||
|
deprecations:
|
||||||
|
- |
|
||||||
|
The ``centos7`` element is deprecated and is left only for backward
|
||||||
|
compatibility. Use the ``centos`` element instead. Note that you should set
|
||||||
|
``DIB_RELEASE`` to ``7`` when using the ``centos`` element.
|
Loading…
Reference in New Issue
Block a user