Remove EOLed CentOS 7 and RHEL 7

CentOS 7 reached EOL on 30th June 2024[1] and RHEL 7 ended its
maintenance support 2 phase[2] the same date.

This change removes the ablity to build images derived from these base
images.

The centos and centos-minimal elements now default to a DIB_RELEASE
value of 9-stream.

[1] https://www.redhat.com/en/topics/linux/centos-linux-eol
[2] https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux/rhel-7-end-of-maintenance

Change-Id: Ic50e08d9f84bbd319129be236d799eade5f40be8
This commit is contained in:
Steve Baker 2024-07-04 14:24:53 +12:00
parent e9be113e8f
commit eb395ec558
56 changed files with 63 additions and 422 deletions

View File

@ -6,14 +6,5 @@ Create a minimal image based on CentOS
Use of this element will require 'yum' and 'yum-utils' to be installed on
Ubuntu and Debian. Nothing additional is needed on Fedora or CentOS.
By default this builds CentOS 7 images. Set ``DIB_RELEASE`` to ``7``,
By default this builds CentOS-Stream 9 images. Set ``DIB_RELEASE`` to
``8`` or ``8-stream`` to explicitly select the release.
For CentOS 7, by default, ``DIB_YUM_MINIMAL_CREATE_INTERFACES`` is set
to enable the creation of
``/etc/sysconfig/network-scripts/ifcfg-eth[0|1]`` scripts to enable
DHCP on the ``eth0`` & ``eth1`` interfaces. If you do not have these
interfaces, or if you are using something else to setup the network
such as cloud-init, glean or network-manager, you would want to set
this to ``0``. For CentOS 8 and CentOS 8 Stream, this is set to ``0`` by
default as the system uses NetworkManager by default.

View File

@ -1,12 +1,5 @@
export DISTRO_NAME=centos
export DIB_RELEASE=${DIB_RELEASE:-7}
export DIB_RELEASE=${DIB_RELEASE:-9-stream}
export EFI_BOOT_DIR="EFI/centos"
# by default, enable DHCP configuration of eth0 & eth1 in network
# scripts for centos 7. See yum-minimal for full details. CentOS 8
# does not come with network-scripts by default so avoid this there.
if [[ "${DIB_RELEASE}" < "8" ]]; then
export DIB_YUM_MINIMAL_CREATE_INTERFACES=${DIB_YUM_MINIMAL_CREATE_INTERFACES:-1}
else
export DIB_YUM_MINIMAL_CREATE_INTERFACES=${DIB_YUM_MINIMAL_CREATE_INTERFACES:-0}
fi
export YUM=dnf
export DIB_YUM_MINIMAL_CREATE_INTERFACES=${DIB_YUM_MINIMAL_CREATE_INTERFACES:-0}

View File

@ -1,5 +0,0 @@
if [[ $DIB_RELEASE == "7" ]]; then
export YUM=yum
else
export YUM=dnf
fi

View File

@ -1 +0,0 @@
Verify we can build a centos-minimal image.

View File

@ -1,6 +0,0 @@
[centos]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=0
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

View File

@ -1,3 +1,4 @@
export DISTRO_NAME=centos
export DIB_RELEASE=${DIB_RELEASE:-8}
export DIB_RELEASE=${DIB_RELEASE:-9-stream}
export EFI_BOOT_DIR="EFI/centos"
export YUM=dnf

View File

@ -1,7 +0,0 @@
# since CentOS 8, dnf is the yum replacement.
if [[ $DIB_RELEASE == "7" ]]; then
export YUM=yum
else
export YUM=dnf
fi

View File

@ -12,10 +12,8 @@ DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-}
# 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\|altarch\)/,baseurl=$DIB_DISTRIBUTION_MIRROR/,;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Base.repo
# CentOS Stream releases (9-stream)
elif [[ ${DIB_RELEASE} =~ '9-stream' ]]; then
if [[ ${DIB_RELEASE} =~ '9-stream' ]]; then
sed -e "s,^#baseurl=http[s]*://mirror.centos.org/\$contentdir/,baseurl=$DIB_DISTRIBUTION_MIRROR/,;/^mirrorlist=/d" -i /etc/yum.repos.d/centos.repo
sed -e "s,^#baseurl=http[s]*://mirror.centos.org/\$contentdir/,baseurl=$DIB_DISTRIBUTION_MIRROR/,;/^mirrorlist=/d" -i /etc/yum.repos.d/centos-addons.repo
# CentOS Stream releases (8-stream)

View File

@ -9,37 +9,21 @@ set -o pipefail
[ -n "$ARCH" ]
[ -n "$TARGET_ROOT" ]
if [[ "${DIB_RELEASE}" = 7 ]]; then
if [[ "amd64 x86_64" =~ "$ARCH" ]]; then
if [[ "amd64 x86_64 arm64 aarch64 ppc64le" =~ "$ARCH" ]]; then
if [[ "amd64" =~ "$ARCH" ]]; then
ARCH="x86_64"
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://cloud.centos.org/centos/${DIB_RELEASE}/images}
elif [[ "arm64 aarch64" =~ "$ARCH" ]]; then
elif [[ "arm64" =~ "$ARCH" ]]; then
ARCH="aarch64"
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://cloud.centos.org/altarch/${DIB_RELEASE}/images/aarch64}
elif [[ "ppc64le" =~ "$ARCH" ]]; then
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://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
if [[ "${DIB_RELEASE}" == "9" ]]; then
dib_release_path=9-stream
else
dib_release_path=${DIB_RELEASE}
fi
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://cloud.centos.org/centos/${dib_release_path}/${ARCH}/images}
else
if [[ "amd64 x86_64 arm64 aarch64 ppc64le" =~ "$ARCH" ]]; then
if [[ "amd64" =~ "$ARCH" ]]; then
ARCH="x86_64"
elif [[ "arm64" =~ "$ARCH" ]]; then
ARCH="aarch64"
fi
if [[ "${DIB_RELEASE}" == "9" ]]; then
dib_release_path=9-stream
else
dib_release_path=${DIB_RELEASE}
fi
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://cloud.centos.org/centos/${dib_release_path}/${ARCH}/images}
else
echo 'centos root element only support the x86_64, aarch64 and ppc64le values for $ARCH'
exit 1
fi
echo 'centos root element only support the x86_64, aarch64 and ppc64le values for $ARCH'
exit 1
fi
DIB_LOCAL_IMAGE=${DIB_LOCAL_IMAGE:-}
@ -53,16 +37,12 @@ if [ -n "$DIB_LOCAL_IMAGE" ]; then
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}
if [[ "${DIB_RELEASE}" == "9" ]]; then
dib_release_path=9-stream
else
if [[ "${DIB_RELEASE}" == "9" ]]; then
dib_release_path=9-stream
else
dib_release_path=${DIB_RELEASE}
fi
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$(head -1 < <(curl -s https://cloud.centos.org/centos/${dib_release_path}/${ARCH}/images/ | grep -o "CentOS-.[^>]*${DIB_FLAVOR}-.[^>]*.qcow2" | sort -r))}
dib_release_path=${DIB_RELEASE}
fi
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$(head -1 < <(curl -s https://cloud.centos.org/centos/${dib_release_path}/${ARCH}/images/ | grep -o "CentOS-.[^>]*${DIB_FLAVOR}-.[^>]*.qcow2" | sort -r))}
BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz
IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE
CACHED_IMAGE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE

View File

@ -1,29 +0,0 @@
=======
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.
For further details see the redhat-common README.
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 ``5/6/7`` 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/7/CentOS-7-x86_64-GenericCloud.qcow2.xz``

View File

@ -1 +0,0 @@
centos

View File

@ -1 +0,0 @@
echo "The centos7 element is deprecated and will be removed in future releases. Use the centos element instead."

View File

@ -1,7 +0,0 @@
# 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}

View File

@ -1,7 +0,0 @@
export DISTRO_NAME=centos7
export DIB_RELEASE=7
export EFI_BOOT_DIR="EFI/centos"
# Useful for elements that work with fedora (dnf) & centos
export YUM=${YUM:-yum}

View File

@ -1,3 +0,0 @@
base
epel
openstack-ci-mirrors

View File

@ -46,6 +46,6 @@ DIB_DHCP_CLIENT
:Description: When NetworkManager is in use, this setting conveys which DHCP
client is in use for acquiring a DHCP address for the node. In some specific
cases, where known that dhclient is the tested or most compatible default,
specifically for Centos 7, 8, and 8-Stream, as well as derived distributions.
specifically for Centos 8, and 8-Stream, as well as derived distributions.
Otherwise, the "internal" dhcp client is the default.
:Example: DIB_DHCP_CLIENT

View File

@ -14,19 +14,8 @@ if [ -z "${DIB_PYTHON_VERSION:-}" ]; then
DIB_PYTHON_VERSION=2
fi
;;
centos7)
DIB_PYTHON_VERSION=2
;;
rhel7)
# TODO(nmagnezi): Remove this when the 'rhel7' element gets replaced by 'rhel'
DIB_PYTHON_VERSION=2
;;
rhel|centos)
if [ "$DIB_RELEASE" == "7" ]; then
DIB_PYTHON_VERSION=2
else
DIB_PYTHON_VERSION=3
fi
DIB_PYTHON_VERSION=3
;;
opensuse)
if [ "${DIB_RELEASE:0:2}" == "42" ]; then

View File

@ -6,8 +6,8 @@ fi
set -eu
set -o pipefail
if [[ ${DISTRO_NAME} =~ (centos|rhel) && ${DIB_RELEASE} > 7 ]]; then
# RHEL8 has a system python, separate from the user python. What
if [[ ${DISTRO_NAME} =~ (centos|rhel) ]]; then
# RHEL8 onwards has a system python, separate from the user python. What
# a good idea, abstracting the python binary for system scripts!
# :) Use it for dib-python.
python_path=/usr/libexec/platform-python

View File

@ -4,18 +4,10 @@
"wget": "wget",
"yum-utils": "yum-utils"
},
"centos7": {
"wget": "wget",
"yum-utils": "yum-utils"
},
"centos": {
"wget": "wget",
"yum-utils": "yum-utils"
},
"rhel7": {
"wget": "wget",
"yum-utils": "yum-utils"
},
"rocky": {
"wget": "wget",
"yum-utils": "yum-utils"

View File

@ -10,27 +10,9 @@ if [[ (${DISTRO_NAME} =~ "almalinux" || ${DISTRO_NAME} =~ "centos" || ${DISTRO_N
# Centos has "epel-release" in extras, which is default enabled.
${YUM} install -y epel-release
else
# For RHEL, we have to scrape the download page to find the latest
# release and install that
[ -n "$ARCH" ]
if [ 'amd64' = "$ARCH" ] ; then
ARCH="x86_64"
fi
BASE_URL=${DIB_EPEL_MIRROR:-https://dl.fedoraproject.org/pub/epel}
case "$DISTRO_NAME" in
rhel7)
RELEASE=7
URL=$BASE_URL/$RELEASE/x86_64/Packages/e/
;;
*)
echo "$DISTRO_NAME is not supported"
# Not really a failure; we just don't do anything
exit 0
;;
esac
PKG_NAME=$(wget -q $URL -O - |grep -oE "(href=\"epel-release-$RELEASE-[0-9,.].*)" | cut -d'"' -f2)
rpm -q epel-release || yum install -y $URL/$PKG_NAME
echo "$DISTRO_NAME is not supported"
# Not really a failure; we just don't do anything
exit 0
fi
if [ ${DIB_EPEL_DISABLED:-0} -ne 0 ]; then

View File

@ -29,7 +29,7 @@ function build_efiboot_img() {
# Ubuntu: grub-efi-amd64-signed and shim-signed
# Fedora: grub2-efi and shim
if [[ $DISTRO_NAME = "fedora" || $DISTRO_NAME = "rhel7" ]] ; then
if [[ $DISTRO_NAME = "fedora" ]] ; then
cp $TMP_BOOTLOADER_DIR/shim.efi $TMP_BUILD_DIR/bootx64.efi
cp $TMP_BOOTLOADER_DIR/grubx64.efi $TMP_BUILD_DIR/grubx64.efi
elif [[ $DISTRO_NAME = "centos" ]] ; then

View File

@ -28,12 +28,6 @@ elif [[ $DISTRO_NAME = "ubuntu" || $DISTRO_NAME = "debian" ]]; then
SHIM_FILE="/usr/lib/shim/shimx64.efi.signed"
SYSLINUX_FILE="/usr/lib/ISOLINUX/isolinux.bin"
LDLINUX_FILE="/usr/lib/syslinux/modules/bios/ldlinux.c32"
#rhel7
elif [ $DISTRO_NAME = "rhel7" ]; then
GRUB_FILE="/boot/efi/EFI/redhat/grubx64.efi"
SHIM_FILE="/boot/efi/EFI/redhat/shim.efi"
SYSLINUX_FILE="/usr/share/syslinux/isolinux.bin"
LDLINUX_FILE="/usr/share/syslinux/ldlinux.c32"
#other
else
GRUB_FILE="/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed"

View File

@ -38,9 +38,6 @@ elif [[ "${DISTRO_NAME}" == "centos" ]]; then
export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_CENTOS_MIRROR
export DIB_EPEL_MIRROR=$NODEPOOL_EPEL_MIRROR
fi
elif [[ "${DISTRO_NAME}" == "centos7" ]]; then
export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_CENTOS_MIRROR
export DIB_EPEL_MIRROR=$NODEPOOL_EPEL_MIRROR
elif [[ "${DISTRO_NAME}" == "opensuse" ]]; then
export DIB_DISTRIBUTION_MIRROR=$NODEPOOL_OPENSUSE_MIRROR
fi

View File

@ -2,7 +2,7 @@
# upgrading packaged system pip/setuptools/virtualenv binaries with
# upstream non-packaged versions, we wish to avoid this completely on
# modern distros.
if [[ $DISTRO_NAME =~ (centos|rhel) && $DIB_RELEASE > 7 ]]; then
if [[ $DISTRO_NAME =~ (centos|rhel) ]]; then
export DIB_INSTALLTYPE_pip_and_virtualenv=${DIB_INSTALLTYPE_pip_and_virtualenv:-package}
if [[ ${DIB_INSTALLTYPE_pip_and_virtualenv} == "source" ]]; then
@ -10,7 +10,6 @@ if [[ $DISTRO_NAME =~ (centos|rhel) && $DIB_RELEASE > 7 ]]; then
exit 1
fi
fi
# The default variables setup below are only useful during the phases
# that dib-python exists
if [[ ! -e /usr/local/bin/dib-python ]]; then

View File

@ -27,7 +27,7 @@ function install_python2_pip {
# force things to happen so our assumptions hold
pip_args="-U --force-reinstall"
if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel|rhel7) ]]; then
if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|rhel) ]]; then
# Default packages
_do_py3=0
@ -35,7 +35,7 @@ if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel|rhel7) ]]; then
# see notes below on this var...
_clear_old_files=0
case "$DISTRO_NAME" in
centos*|rhel7)
centos*)
# note python2-pip in epel
_extra_repo="--enablerepo=epel"
packages="python-virtualenv python2-pip"
@ -65,17 +65,6 @@ if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel|rhel7) ]]; then
_clear_old_files=0
packages=" python3-virtualenv python3-pip python3-setuptools"
;;
7)
# note python2-pip in epel
_extra_repo="--enablerepo=epel"
_clear_old_files=1
packages="python-virtualenv python2-pip"
if [[ "$(rpm -q --qf '[%{obsoletes}\n]' python2-setuptools)" == "python-setuptools" ]]; then
packages+=" python2-setuptools"
else
packages+=" python-setuptools"
fi
;;
esac
;;
opensuse)

View File

@ -26,9 +26,8 @@ log = logging.getLogger()
def os_family(distro):
family = None
if distro in ['almalinux', 'fedora', 'rhel', 'rhel7', 'centos', 'centos7',
'openeuler',
'rocky']:
if distro in ['almalinux', 'fedora', 'rhel', 'centos', 'openeuler',
'rocky']:
family = 'redhat'
elif distro in ['debian', 'ubuntu']:
family = 'debian'

View File

@ -30,7 +30,7 @@ case "$DISTRO_NAME" in
source versions.deb
dpkg -i $XE_GUEST_UTILITIES_PKG_FILE_amd64
;;
'fedora'|'centos'|'centos7'|'opensuse')
'fedora'|'centos'|'opensuse')
source versions.rpm
rpm -Uvh $XE_GUEST_UTILITIES_PKG_FILE_x86_64
;;

View File

@ -85,7 +85,7 @@ respawn
exec /sbin/getty -L 115200 hvc0 vt102
EOF
;;
'fedora'|'centos'|'centos7'|'opensuse')
'fedora'|'centos'|'opensuse')
cat > /usr/local/bin/run-nova-agent.sh <<'EOF'
#!/bin/bash

View File

@ -21,7 +21,7 @@ DIB_LOCAL_IMAGE
diskimage-builder as input. The cloud image does not have to have been built
by diskimage-builder. It should be a full disk image, not just a filesystem
image.
:Example: ``DIB_LOCAL_IMAGE=rhel-guest-image-7.1-20150224.0.x86_64.qcow2``
:Example: ``DIB_LOCAL_IMAGE=rhel-9.4-x86_64-kvm.qcow2``
DIB_DISABLE_KERNEL_CLEANUP
:Required: No

View File

@ -1,18 +0,0 @@
{
"release": {
"rhel": {
"7": {
"python3-libselinux": "libselinux-python",
"python3-policycoreutils": "policycoreutils",
"policycoreutils-python-utils": "policycoreutils-python"
}
},
"centos": {
"7": {
"python3-libselinux": "libselinux-python",
"python3-policycoreutils": "policycoreutils",
"policycoreutils-python-utils": "policycoreutils-python"
}
}
}
}

View File

@ -13,10 +13,7 @@ arch=$(uname -m)
repos="repos "
base_repos=
if [ "${DIB_RELEASE:-7}" == "7" ]; then
base_repos="rhel-7-server-rpms"
satellite_repo="${REG_SAT_REPO:-"rhel-7-server-satellite-client-6-rpms"}"
elif [ "${DIB_RELEASE}" == "8" ]; then
if [ "${DIB_RELEASE}" == "8" ]; then
if [ -n "${REG_RELEASE:-}" ]; then
base_repos="rhel-8-for-${arch}-appstream-eus-rpms rhel-8-for-${arch}-baseos-eus-rpms"
else

View File

@ -10,8 +10,8 @@ path to the resulting file to disk-image-create as the ``DIB_LOCAL_IMAGE``
environment variable.
The cloud image can be found at (login required):
RHEL8: https://access.redhat.com/downloads/content/479/ver=/rhel---8/8.0/x86_64/product-software
RHEL7: https://access.redhat.com/downloads/content/69/ver=/rhel---7/7.1/x86_64/product-downloads
RHEL8: https://access.redhat.com/downloads/content/479/ver=/rhel---8/8.10/x86_64/product-software
RHEL9: https://access.redhat.com/downloads/content/479/ver=/rhel---9/9.4/x86_64/product-software
Then before running the image build, define DIB_LOCAL_IMAGE (replace the file
@ -19,7 +19,7 @@ name with the one downloaded, if it differs from the example):
.. code-block:: bash
export DIB_LOCAL_IMAGE=rhel-8.0-x86_64-kvm.qcow2
export DIB_LOCAL_IMAGE=rhel-9.4-x86_64-kvm.qcow2
The downloaded file will then be used as the basis for any subsequent image
builds.
@ -33,8 +33,8 @@ Environment Variables
DIB_LOCAL_IMAGE
:Required: Yes
:Default: None
:Description: The RHEL 8 base image you have downloaded. See the element
:Description: The RHEL base image you have downloaded. See the element
description above for more details.
:Example: ``DIB_LOCAL_IMAGE=/tmp/rhel8-cloud.qcow2``
:Example: ``DIB_LOCAL_IMAGE=/tmp/rhel-9.4-x86_64-kvm.qcow2``

View File

@ -1,3 +1,4 @@
export DISTRO_NAME=rhel
export DIB_RELEASE=${DIB_RELEASE:-8}
export EFI_BOOT_DIR="EFI/redhat"
export YUM=dnf

View File

@ -1,7 +0,0 @@
# since RHEL8, dnf is the yum replacement.
if [[ $DIB_RELEASE == "7" ]]; then
export YUM=yum
else
export YUM=dnf
fi

View File

@ -1,42 +0,0 @@
=====
rhel7
=====
.. warning::
This element is deprecated and is left only for backward compatibility.
Use the `rhel` element instead. Note that you should set DIB_RELEASE to 7
to indicate which release you are using. Please read the notes.
Use RHEL 7 cloud images as the baseline for built disk images.
Because RHEL 7 base images are not publicly available, it is necessary to first
download the RHEL 7 cloud image from the Red Hat Customer Portal and pass the
path to the resulting file to disk-image-create as the ``DIB_LOCAL_IMAGE``
environment variable.
The cloud image can be found at (login required):
https://access.redhat.com/downloads/content/69/ver=/rhel---7/7.1/x86_64/product-downloads
Then before running the image build, define DIB_LOCAL_IMAGE (replace the file
name with the one downloaded, if it differs from the example):
.. code-block:: bash
export DIB_LOCAL_IMAGE=rhel-guest-image-7.1-20150224.0.x86_64.qcow2
The downloaded file will then be used as the basis for any subsequent image
builds.
For further details about building RHEL 7 images, see the rhel-common and
redhat-common element README files.
Environment Variables
---------------------
DIB_LOCAL_IMAGE
:Required: Yes
:Default: None
:Description: The RHEL 7 base image you have downloaded. See the element
description above for more details.
:Example: ``DIB_LOCAL_IMAGE=/tmp/rhel7-cloud.qcow2``

View File

@ -1 +0,0 @@
rhel

View File

@ -1 +0,0 @@
echo "The rhel7 element is deprecated and will be removed in future releases. Use the rhel element instead."

View File

@ -1 +0,0 @@
export DIB_RELEASE=7

View File

@ -4,7 +4,7 @@ else
export DIB_SIMPLE_INIT_NETWORKMANAGER=${DIB_SIMPLE_INIT_NETWORKMANAGER:-0}
fi
if [[ (${DISTRO_NAME} == "almalinux" || ${DISTRO_NAME} == "centos" || ${DISTRO_NAME} == "rocky") && $DIB_RELEASE > 7 ]] || [[ ${DISTRO_NAME} == "fedora" ]]; then
if [[ (${DISTRO_NAME} == "almalinux" || ${DISTRO_NAME} == "rocky") && $DIB_RELEASE > 7 ]] || [[ ${DISTRO_NAME} == "fedora" ]]; then
if [[ $DIB_SIMPLE_INIT_NETWORKMANAGER == 0 ]]; then
echo "simple-init only supports NetworkManager mode on Fedora and AlmaLinux/CentOS/Rocky 8 & 9"
exit 1

View File

@ -12,15 +12,7 @@ case "$DIB_INIT_SYSTEM" in
exit 0
;;
systemd)
if [[ ${DISTRO_NAME} == centos && ${DIB_RELEASE} == 7 ]]; then
if [[ ${DIB_SIMPLE_INIT_NETWORKMANAGER} != 1 ]]; then
# NOTE(pabelanger): Glean requires network.service for
# these platforms when not using networkmanager
# Not available on Centos 8
# NOTE(ianw) we should evaluate if Fedora needs this
systemctl enable network.service
fi
elif [[ ${DISTRO_NAME} =~ (opensuse) ]]; then
if [[ ${DISTRO_NAME} =~ (opensuse) ]]; then
# on suse, this is named wicked.service, but it's the same
# as network.service.
systemctl enable wicked.service

View File

@ -21,7 +21,7 @@ import yaml
def os_family(distro):
"Given a distribution, returns a operating system family."
family = None
if distro in ['centos', 'centos7', 'fedora', 'rhel', 'rhel7']:
if distro in ['centos', 'fedora', 'rhel']:
family = 'redhat'
elif distro in ['debian', 'ubuntu']:
family = 'debian'

View File

@ -11,10 +11,5 @@ linux-firmware:
uninstall: true
linux-firmware-whence:
uninstall: true
# NOTE(ianw) pkg-map restricts this to !rhel/centos 7; in 7
# the "initscripts" package handles basic networking, in
# 8+ it's the role of NetworkManager and dhcp-client. This
# mirrors the default packages installed in upstream cloud images
# to facilitate a basic network.
NetworkManager:
dhcp-client:

View File

@ -1,10 +1,6 @@
{
"release": {
"centos": {
"7": {
"NetworkManager": "",
"dhcp-client": ""
},
"9-stream": {
"lsb_release": "ed hostname patch postfix tar time"
}

View File

@ -23,56 +23,6 @@ set -o pipefail
# effectively: febootstrap-minimize --keep-zoneinfo --keep-rpmdb --keep-services "$target"
# This is only required on CentOS7 ... see notes in
# root.d/08-yum-chroot about %_install_langs
if [[ $DISTRO_NAME == "centos" && $DIB_RELEASE == "7" ]]; then
# Stripping *all* locales is a bad idea. For now, we take the
# suggestion in [1] for reducing this
# [1] https://bugzilla.redhat.com/show_bug.cgi?id=156477
if [ ! -f /usr/lib/locale/locale-archive ]; then
die "locale-archive not found? Can not do cleanup."
fi
# now the archive has everything in it, and is about 100MiB. Strip it
# to just en_US (basically, this is the locale we support if you ssh
# in, other than POSIX)
localedef --delete-from-archive \
$(localedef --list-archive | grep -v '^en_US' | xargs)
# This removes the locales from the archive index but doesn't rebuild
# the file, so it is still the same size (maybe it is sparse?
# presumably as it's mmapped you don't want to fiddle with the offsets
# of locales in the archive on a live system. We are not live).
# build-locale-archive is a tool provided by the RH packaging of
# glibc. Documentation is scarce, but it takes the pre-built locales
# in the tmpl file and creates an archive. It seems originally the
# installer would set some flags to rpm to tell the package what
# languages to pick out of the template, but along the way, this was
# reverted to install them (size considered less important than locale
# support).
# We hack this by moving the locale-archive we've removed the extra
# locales from to the template, then re-run the build.
mv /usr/lib/locale/locale-archive /usr/lib/locale/locale-archive.tmpl
# rebuild archive from template
/usr/sbin/build-locale-archive
# leave empty template behind as package does. I think this stops
# upgrades redoing things
echo > /usr/lib/locale/locale-archive.tmpl
# remove the unnecessary source locale files and iconv files
pushd /usr/share/locale
find . ! -name 'locale.alias' -delete
popd
rm -rf {lib.lib64}/gconv
fi
# docs
rm -rf /usr/share/{doc,info,gnome/help}
# i18n

View File

@ -88,7 +88,7 @@ function _install_repos {
if [[ ${DISTRO_NAME} = fedora ]]; then
packages+="fedora-release-cloud fedora-release-common "
packages+="fedora-repos fedora-gpg-keys"
elif [[ ${DISTRO_NAME} = centos && ${DIB_RELEASE%-stream} -gt 7 ]]; then
elif [[ ${DISTRO_NAME} = centos ]]; then
packages+="centos-gpg-keys "
if [[ "$DIB_RELEASE" =~ (stream) ]]; then
packages+="centos-stream-release centos-stream-repos "
@ -98,11 +98,6 @@ function _install_repos {
elif [[ ${DISTRO_NAME} == 'openeuler' ]]; then
packages+="openEuler-release "
packages+="openEuler-repos openEuler-gpg-keys "
else
# NOTE(ianw) 2022-04-20 : can probably remove when we don't
# support centos 7, unlikely anything else ends up here at
# this point.
packages+="${DISTRO_NAME}-release "
fi
# By default, parent elements (fedora-minimal, centos-minimal)
@ -210,8 +205,7 @@ function _install_pkg_manager {
local _lang_pack=""
local _extra_pkgs=""
if [[ $DISTRO_NAME == "fedora" ]] || \
[[ $DISTRO_NAME == "centos" && $DIB_RELEASE > "7" ]]; then
if [[ $DISTRO_NAME == "fedora" ]]; then
# glibc from F24 onwards has split locales into "langpack"
# packages. Host yum doesn't understand the
# weak-dependencies glibc now uses to get the
@ -310,7 +304,7 @@ _install_repos
# seemingly mismatched libraries.
if [[ ${DISTRO_NAME} =~ (fedora|openeuler) ]]; then
_install_pkg_manager dnf dnf-plugins-core curl
elif [[ ${DISTRO_NAME} == centos && $DIB_RELEASE > "7" ]]; then
elif [[ ${DISTRO_NAME} == centos ]]; then
_install_pkg_manager dnf dnf-plugins-core curl libcurl
else
_install_pkg_manager yum
@ -324,25 +318,6 @@ function _run_chroot {
sudo -E chroot $TARGET_ROOT env -u TMPDIR sh -c "$cmd"
}
# The rpmdb has been created by the host RPM. CentOS 7 only
# understands bdb-based db's, while the host is (likey as not) a more
# modern rpm that has created a sqlite db. These don't share files in
# common, so to the in-chroot rpm the db just looks empty. This is a
# super-weird state that the system is in, because everything is
# installed and working, but packages don't look like they are. One
# consequence of this is that yum's querying to setup the $releasever
# variable fails and it remains unset. Because the default .repo
# files use this we get invalid repo paths for any yum commands. The
# easiest way around this seems to be to manually set --releasever=7;
# this way yum can rebuild itself and recreate the rpmdb as it likes.
# This is a mess that can hopefully go away when we don't care about
# CentOS 7. For this reason, we only do this for CentOS 7, to avoid
# hiding any problems on other distros. We only need to do this
# for these initial steps, after that the db is correct.
if [[ ${DISTRO_NAME} = centos && ${DIB_RELEASE%-stream} -le 7 ]]; then
YUM="${YUM} --releasever=${DIB_RELEASE}"
fi
# we just installed yum/dnf with "outside" tools (yum/rpm) which
# might have created /var/lib/[yum|rpm] (etc) that are slighlty
# incompatible. Refresh everything with the in-chroot tools

View File

@ -33,11 +33,3 @@ DIB_DNF_MODULE_STREAMS
stream for the given module is first disabled prior to enabling the specified
stream.
:Example: ``DIB_DNF_MODULE_STREAMS='virt:8.2 container-tools:3.0'``
DIB_CENTOS_7_PREINSTALL_EPEL_URL_PACKAGE
:Required: No
:Default: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
:Description: The environment variable is used to override default value in pre-install
stage to install epel repository from custom source
:Example: ``DIB_CENTOS_7_PREINSTALL_EPEL_URL_PACKAGE=http://repos.example.com/epel/epel-latest-7.noarch.rpm``

View File

@ -10,18 +10,8 @@ set -o pipefail
# early (even before package-installs, which is written in Python and
# uses YAML).
if [[ ${DISTRO_NAME} =~ (centos|rhel) && ${DIB_RELEASE} == 7 ]]; then
# Our package map and install stuff doesn't have a way to say
# "install this from EPEL". So we hack in an install of it here
# from EPEL. Nothing else should have installed EPEL at this
# early stage.
yum install -y python3
# NOTE(dpawlik) The epel-release package is not available in RHEL.
yum install -y ${DIB_CENTOS_7_PREINSTALL_EPEL_URL_PACKAGE:-https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm}
yum install -y python36-PyYAML
yum remove -y epel-release
elif [[ ${DISTRO_NAME} =~ (centos|rhel) && ${DIB_RELEASE} > 7 ]]; then
# For 8 and above ensure the "user" python3 package is installed
if [[ ${DISTRO_NAME} =~ (centos|rhel) ]]; then
# Ensure the "user" python3 package is installed
# so we have /usr/bin/python3 and pyyaml.
dnf install -y python3 python3-pyyaml
fi

View File

@ -19,8 +19,7 @@ set -eE
# Set/override locale. This ensures consistency in sorting etc. We
# need to choose a lowest-common denominator locale, as this is
# applied when running in the building chroot too (maybe a bug and we
# should prune this?). Thus "C" --centOS 7 doesn't include C.utf-8
# (fedora does, centos 8 probably will). Note: LC_ALL to really
# should prune this?). Note: LC_ALL to really
# override this; it overrides LANG and all other LC_ vars
export LC_ALL=C

View File

@ -34,7 +34,7 @@ function create_ramdisk_base () {
mkdir -p "${TMP_MOUNT_PATH}/"{lib/udev/rules.d,var/{lib/dhcp,run}}
case "$DISTRO_NAME" in
fedora|rhel|rhel7|opensuse)
fedora|rhel|opensuse)
mkdir -p "$TMP_MOUNT_PATH/usr"
ln -s ../lib "$TMP_MOUNT_PATH/usr/lib"
if [[ "`uname -m`" =~ x86_64|ppc64 ]]; then

View File

@ -477,7 +477,7 @@ example if one were building tripleo-images, the variable would be set like:
.. sourcecode:: sh
export ELEMENTS_PATH=tripleo-image-elements/elements
disk-image-create rhel7 cinder-api
disk-image-create rhel cinder-api
Linting
-------

View File

@ -89,7 +89,7 @@ is correct.
As of Feburary 2022, the default end-to-end testing covers the
following elements on x86-64
* ``centos-minimal``: CentOS 7, 8-stream and 9-stream
* ``centos-minimal``: 8-stream and 9-stream
* ``fedora-containerfile``: the latest Fedora.
* ``ubuntu-minimal``: Ubuntu Xenial, Bionic and Focal
* ``opensuse-minimal``: Leap 15.3 and Tumbleweed (non-voting)

View File

@ -0,0 +1,6 @@
---
upgrade:
- |
It is no longer possible to build images using CentOS 7 or RHEL 7 as a base
image as these reached EOL on 30th June 2024. The centos and centos-minimal
elements now default to a ``DIB_RELEASE`` value of ``9-stream``.

View File

@ -5,23 +5,6 @@
- debug: msg="zuul site mirror {{ zuul_site_mirror_fqdn }}"
- debug: msg="mirror_fqdn {{ mirror_fqdn }}"
- name: Create centos-minimal 7 directory
file:
path: "{{ dib_gate_mirror_repos }}/centos-minimal/7/yum.repos.d"
state: directory
mode: 0775
recurse: yes
- name: Install centos-minimal 7 repo files
template:
dest: "{{ dib_gate_mirror_repos }}/centos-minimal/7/yum.repos.d/dib-mirror-{{ item }}"
mode: 0644
src: "centos-minimal/7/{{ item }}.j2"
with_items:
- base.repo
- updates.repo
- extras.repo
- name: Create centos-minimal 8-stream directory
file:
path: "{{ dib_gate_mirror_repos }}/centos-minimal/8-stream/yum.repos.d"

View File

@ -39,7 +39,6 @@ DEFAULT_SKIP_TESTS=(
# better caching for the images
opensuse/build-succeeds
opensuse/opensuse15-build-succeeds
centos7/build-succeeds
debian/build-succeeds
fedora/build-succeeds
ubuntu/trusty-build-succeeds