Add support for CentOS Stream 9 in DIB

CentOS Stream 9 is close to be released, and official mirrors are
already poplated. This patch is adding support to centos-minimal in CS9.

Also enable centos-minimal/[8,9]-stream-build-succeeds tests.

This patch is being tested together with [1] to apply following list of elements:

 vm centos-minimal simple-init growroot nodepool-base openstack-repos infra-package-needs

[1] https://review.opendev.org/c/openstack/project-config/+/811442

Change-Id: Iecf7f7e4c992bb23437b6461cdd04cdca96aafa6
This commit is contained in:
Alfredo Moralejo 2021-09-28 12:35:15 +02:00
parent d5a01519c6
commit cdff9045c0
19 changed files with 114 additions and 5 deletions

View File

@ -105,6 +105,19 @@
# TODO: set when CentOS 8 Stream repos mirrored.
# mirror: "http://{{ zuul_site_mirror_fqdn }}/centos"
- job:
name: dib-nodepool-functional-openstack-centos-9-stream-src
description: |
Test building and booting a Centos 9 Stream image with Nodepool and
OpenStack.
parent: dib-nodepool-functional-src-base
vars:
nodepool_diskimage:
base_element: centos-minimal
release: '9-stream'
# TODO: set when CentOS 9 Stream repos mirrored.
# mirror: "http://{{ zuul_site_mirror_fqdn }}/centos"
- job:
name: dib-nodepool-functional-openstack-fedora-34-containerfile-src
description: |

View File

@ -17,6 +17,7 @@
- dib-nodepool-functional-openstack-centos-7-src
- dib-nodepool-functional-openstack-centos-8-src
- dib-nodepool-functional-openstack-centos-8-stream-src
- dib-nodepool-functional-openstack-centos-9-stream-src
- dib-nodepool-functional-openstack-fedora-34-containerfile-src
- dib-nodepool-functional-openstack-ubuntu-xenial-src
- dib-nodepool-functional-openstack-ubuntu-bionic-src
@ -46,6 +47,7 @@
- dib-nodepool-functional-openstack-centos-7-src
- dib-nodepool-functional-openstack-centos-8-src
- dib-nodepool-functional-openstack-centos-8-stream-src
- dib-nodepool-functional-openstack-centos-9-stream-src
- dib-nodepool-functional-openstack-fedora-34-containerfile-src
- dib-nodepool-functional-openstack-ubuntu-xenial-src
- dib-nodepool-functional-openstack-ubuntu-bionic-src

View File

@ -103,5 +103,31 @@ baseurl=$NODEPOOL_CENTOS_MIRROR/\$releasever/extras/\$basearch/os/
gpgcheck=0
EOF
# Centos 8-stream Minimal
CENTOS_MIN_DIR=$BASE_DIR/centos-minimal/yum.repos.d/8-stream
mkdir -p $CENTOS_MIN_DIR
cat <<EOF > $CENTOS_MIN_DIR/dib-mirror-base.repo
[base]
name=CentOS-\$releasever - Base
baseurl=$NODEPOOL_CENTOS_MIRROR/\$releasever/BaseOS/\$basearch/os/
gpgcheck=0
EOF
cat <<EOF > $CENTOS_MIN_DIR/dib-mirror-appstream.repo
[base]
name=CentOS-\$releasever - AppStream
baseurl=$NODEPOOL_CENTOS_MIRROR/\$releasever/AppStream/\$basearch/os/
gpgcheck=0
EOF
cat <<EOF > $CENTOS_MIN_DIR/dib-mirror-extras.repo
#additional packages that may be useful
[extras]
name=CentOS-\$releasever - Extras
baseurl=$NODEPOOL_CENTOS_MIRROR/\$releasever/extras/\$basearch/os/
gpgcheck=0
EOF
## apt sources (todo)

View File

@ -163,6 +163,12 @@ if grep -qe "^\s*GRUB_ENABLE_BLSCFG=true" /etc/default/grub; then
USE_GRUBBY=true
fi
# When building CentOS9 with centos-minimal /etc/default/grub does not exist
# after grub2-tools installation. However we need CS9 to use grubby.
if [[ "$DISTRO_NAME" == "centos" ]] && [[ $DIB_RELEASE =~ 9 ]]; then
USE_GRUBBY=true
fi
# Override the root device to the default label, and disable uuid
# lookup.
if [ -n "$USE_GRUBBY" ]; then

View File

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

View File

@ -1,5 +1,5 @@
[Stream-AppStream]
name=CentOS-Stream - AppStream
mirrorlist=http://mirrorlist.centos.org/?release=8-stream&arch=$basearch&repo=AppStream
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream
gpgcheck=0

View File

@ -1,5 +1,5 @@
[Stream-BaseOS]
name=CentOS-Stream - Base
mirrorlist=http://mirrorlist.centos.org/?release=8-stream&arch=$basearch&repo=BaseOS
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS
gpgcheck=0

View File

@ -0,0 +1,10 @@
[appstream]
name=CentOS Stream 9 - AppStream
metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-9-stream&arch=$basearch
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=0
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=1

View File

@ -0,0 +1,10 @@
[baseos]
name=CentOS Stream 9 - BaseOS
metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-9-stream&arch=$basearch
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=0
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=1

View File

@ -17,4 +17,4 @@ linux-firmware-whence:
# mirrors the default packages installed in upstream cloud images
# to facilitate a basic network.
NetworkManager:
dhcp-client:
dhcp-client:

View File

@ -15,6 +15,13 @@
}
}
},
"release": {
"centos": {
"9-stream": {
"lsb_release": "ed hostname patch postfix tar time"
}
}
},
"family": {
"redhat": {
"lsb_release": "redhat-lsb-core"

View File

@ -87,6 +87,8 @@ function _install_repos {
packages+="basesystem filesystem setup "
if [[ ${DISTRO_NAME} = fedora && ${DIB_RELEASE} -gt 29 ]]; then
packages+="fedora-release-cloud fedora-release-common "
elif [[ ${DISTRO_NAME} == 'centos' && ${DIB_RELEASE} = '9-stream' ]]; then
packages+="bash glibc ncurses-libs "
elif [[ ${DISTRO_NAME} == 'openeuler' ]]; then
packages+="openEuler-release "
else
@ -104,7 +106,7 @@ function _install_repos {
fi
# CentOS 8.1 split repositories and GPG keys out into subpackages
if [[ ${DISTRO_NAME} = centos && ${DIB_RELEASE} > "7" ]]; then
if [[ ${DISTRO_NAME} = centos && ${DIB_RELEASE%-stream} -gt 7 ]]; then
packages+="centos-gpg-keys "
if [[ "$DIB_RELEASE" =~ (stream) ]]; then
packages+="centos-stream-release centos-stream-repos "
@ -141,7 +143,7 @@ function _install_repos {
local temp_tmp
temp_tmp=$(mktemp -d)
TMPDIR=${temp_tmp} ${HOST_YUM_DOWNLOADER} --verbose \
--releasever=${DIB_RELEASE/-*/} \
--releasever=${DIB_RELEASE} \
--setopt=reposdir=$repo \
--setopt=cachedir=$temp_tmp \
--destdir=$WORKING \

View File

@ -49,6 +49,7 @@
args:
executable: /bin/bash
become: yes
when: ansible_os_family == 'Debian'
- name: Run dib functional tests
shell:

View File

@ -39,6 +39,22 @@
- appstream.repo
- extras.repo
- name: Create centos-minimal 9-stream directory
file:
path: "{{ dib_gate_mirror_repos }}/centos-minimal/9-stream/yum.repos.d"
state: directory
mode: 0775
recurse: yes
- name: Install centos-minimal 9-stream repo files
template:
dest: "{{ dib_gate_mirror_repos }}/centos-minimal/9-stream/yum.repos.d/dib-mirror-{{ item }}"
mode: 0644
src: "centos-minimal/9-stream/{{ item }}.j2"
with_items:
- base.repo
- appstream.repo
- name: Create fedora-minimal directories
file:
path: "{{ dib_gate_mirror_repos }}/fedora-minimal/{{ item }}/yum.repos.d"

View File

@ -0,0 +1,6 @@
[Stream-AppStream]
name=CentOS-Stream - AppStream
# Switch to mirrors once available
metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-9-stream&arch=$basearch
gpgcheck=0

View File

@ -0,0 +1,6 @@
[Stream-BaseOS]
name=CentOS-Stream - BaseOS
# Switch to mirrors once available
metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-9-stream&arch=$basearch
gpgcheck=0

View File

@ -7,6 +7,7 @@ sudo apt-get update || true
sudo apt-get install -y --force-yes \
docker.io || \
sudo yum -y install --enablerepo=epel \
yum-utils \
debootstrap \
dpkg \
docker || \