Use centos-8 stream for molecule jobs

This patch migrates all the molecule jobs for using CentOS-8 Stream
instead UBI8 images.

Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
Change-Id: Ied32122e5ec042a141a21c8cc3b43f7e0ef65da8
(cherry picked from commit dd088d7a77)
This commit is contained in:
Gael Chamoulaud (Strider) 2021-11-24 13:10:42 +01:00
parent 18dc3ca254
commit 65f7634236
No known key found for this signature in database
GPG Key ID: 4119D0305C651D66
17 changed files with 50 additions and 44 deletions

View File

@ -21,15 +21,17 @@ FROM {{ item.registry.url }}/{{ item.image }}
FROM {{ item.image }}
{% endif %}
RUN dnf makecache && dnf install -y sudo python*-devel python*-dnf bash {{ item.pkg_extras | default('') }}
# TODO(gchamoul): find a better to get always the latest version of those rpms
# below from the centos mirror
RUN dnf install -y http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8-2.el8.noarch.rpm
RUN dnf install -y http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-linux-repos-8-2.el8.noarch.rpm && dnf install -y epel-release && dnf clean all
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install sudo python*-devel python*-dnf bash epel-release {{ item.pkg_extras | default('') }} && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl python-setuptools bash {{ item.pkg_extras | default('') }} && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates {{ item.pkg_extras | default('') }}; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates {{ item.pkg_extras | default('') }} && xbps-remove -O; fi
{% for pkg in item.easy_install | default([]) %}
# install pip for centos where there is no python-pip rpm in default repos
RUN easy_install {{ pkg }}
{% endfor %}
CMD ["sh", "-c", "while true; do sleep 10000; done"]

View File

@ -12,9 +12,9 @@
# you will have to redefine them completely in your molecule.yml (at the role
# level) and add your extra configuration!
#
# For instance, if you need to add an extra package in your ubi8 container, you
# will have to add the entire "platforms" key into your molecule.yml file and
# add your package name in the pkg_extras key.
# For instance, if you need to add an extra package in your CentOS 8 Stream
# container, you will have to add the entire "platforms" key into your
# molecule.yml file and add your package name in the pkg_extras key.
#
# No merge will happen between your molecule.yml and this config.yml
# files. That's why you will have to redefine them completely.
@ -25,11 +25,11 @@ driver:
log: true
platforms:
- name: ubi8
hostname: ubi8
image: ubi8/ubi-init
- name: centos
hostname: centos
image: centos/centos:stream8
registry:
url: registry.access.redhat.com
url: quay.io
dockerfile: ../../../../.config/molecule/Dockerfile
pkg_extras: python*-setuptools python*-pyyaml
volumes:
@ -47,7 +47,7 @@ provisioner:
hosts:
all:
hosts:
ubi8:
centos:
ansible_python_interpreter: /usr/bin/python3
log: true
options:

View File

@ -2,4 +2,5 @@
collections:
- containers.podman
- community.general
- community.crypto
- ansible.posix

View File

@ -25,6 +25,13 @@
virtualenv_command: "{{ ensure_pip_virtualenv_command }}"
virtualenv_site_packages: true
- name: Set containers module to 3.0
become: true
shell: |
dnf module disable container-tools:rhel8 -y
dnf module enable container-tools:3.0 -y
dnf clean metadata
- name: Run bindep
shell: |-
. {{ ansible_user_dir }}/test-python/bin/activate

View File

@ -646,10 +646,7 @@ Molecule.
driver to delegate the task of creating instances.
* The ``Platforms`` definitions: Molecule relies on this to know which instances
to create, name and to which group each instance
belongs. ``Tripleo-validations`` uses ``Universal Base Images (UBI8)`` which
are container images based on a foundation of Red Hat Enterprise Linux
software. See `Using Red Hat Universal Base Images`_ for details on using Red
Hat UBI container images.
belongs. ``Tripleo-validations`` uses ``CentOS 8 Stream image``.
* The ``Provisioner``: Molecule only provides an Ansible provisioner. Ansible
manages the life cycle of the instance based on this configuration.
* The ``Scenario`` definition: Molecule relies on this configuration to control
@ -658,8 +655,6 @@ Molecule.
to write specific stat checking tests (such as deployment smoke tests) on the
target instance.
.. _Using Red Hat Universal Base Images: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/building_running_and_managing_containers/index/#using_red_hat_universal_base_images_standard_minimal_and_runtimes
Local testing of new roles
--------------------------

View File

@ -3,11 +3,11 @@
# To override default values, please take a look at the config.yml.
platforms:
- name: ubi8
hostname: ubi8
image: ubi8/ubi-init
- name: centos
hostname: centos
image: centos/centos:stream8
registry:
url: registry.access.redhat.com
url: quay.io
dockerfile: ../../../../.config/molecule/Dockerfile
pkg_extras: python*setuptools python*-pyyaml iputils
volumes:

View File

@ -46,7 +46,7 @@
include_role:
name: check_uc_hostname
vars:
check_uc_hostname_inventory_host: ubi8
check_uc_hostname_inventory_host: centos
- name: Working 2 - openstack multiple entry in list
copy:
@ -83,7 +83,7 @@
include_role:
name: check_uc_hostname
vars:
check_uc_hostname_inventory_host: ubi8
check_uc_hostname_inventory_host: centos
- name: Working 3 - openstack multiple entry in list
copy:
@ -117,7 +117,7 @@
include_role:
name: check_uc_hostname
vars:
check_uc_hostname_inventory_host: ubi8
check_uc_hostname_inventory_host: centos
- name: Working 4 - openstack multiple entry in list
copy:
@ -149,7 +149,7 @@
include_role:
name: check_uc_hostname
vars:
check_uc_hostname_inventory_host: ubi8
check_uc_hostname_inventory_host: centos
- name: Failing 1 - we fail if DockerInsecureRegistryAddress is not found
copy:
@ -176,7 +176,7 @@
- include_role:
name: check_uc_hostname
vars:
check_uc_hostname_inventory_host: ubi8
check_uc_hostname_inventory_host: centos
rescue:
- name: Clear host errors
@ -219,7 +219,7 @@
- include_role:
name: check_uc_hostname
vars:
check_uc_hostname_inventory_host: ubi8
check_uc_hostname_inventory_host: centos
rescue:
- name: Clear host errors

View File

@ -8,7 +8,7 @@ provisioner:
hosts:
all:
hosts:
ubi8:
centos:
ansible_python_interpreter: /usr/bin/python3
vars:
plan: qe-Cloud-0

View File

@ -3,11 +3,11 @@
# To override default values, please take a look at the config.yml.
platforms:
- name: ubi8
hostname: ubi8
image: ubi8/ubi:8.2
- name: centos
hostname: centos
image: centos/centos:stream8
registry:
url: registry.access.redhat.com
url: quay.io
etc_hosts:
undercloud.ctlplane.mydomain.tld: "127.0.0.1"
dockerfile: ../../../../.config/molecule/Dockerfile

View File

@ -11,7 +11,7 @@ provisioner:
hosts:
all:
hosts:
ubi8:
centos:
ansible_python_interpreter: /usr/bin/python3
log: true
env:

View File

@ -11,7 +11,7 @@ provisioner:
hosts:
all:
hosts:
ubi8:
centos:
ansible_python_interpreter: /usr/bin/python3
log: true
env:

View File

@ -11,7 +11,7 @@ provisioner:
hosts:
all:
hosts:
ubi8:
centos:
ansible_python_interpreter: /usr/bin/python3
overcloud_keystone_url: http://127.0.0.1:8080
overcloud_admin_password: hello

View File

@ -11,7 +11,7 @@ provisioner:
hosts:
all:
hosts:
ubi8:
centos:
ansible_python_interpreter: /usr/bin/python3
overcloud_keystone_url: http://127.0.0.1:8080
overcloud_admin_password: hello

View File

@ -11,7 +11,7 @@ provisioner:
hosts:
all:
hosts:
ubi8:
centos:
ansible_python_interpreter: /usr/bin/python3
overcloud_keystone_url: http://127.0.0.1:8080
overcloud_admin_password: hello

View File

@ -3,11 +3,11 @@
# To override default values, please take a look at the config.yml.
platforms:
- name: ubi8
hostname: ubi8
image: ubi8/ubi-init
- name: centos
hostname: centos
image: centos/centos:stream8
registry:
url: registry.access.redhat.com
url: quay.io
dockerfile: ../../../../.config/molecule/Dockerfile
pkg_extras: python*-setuptools python*-pyyaml krb5-workstation
volumes:

View File

@ -75,6 +75,7 @@ fi
# Run local test
source "${PROJECT_DIR}/ansible-test-env.rc"
export ANSIBLE_ROLES_PATH="${ANSIBLE_ROLES_PATH}:${HOME}/zuul-jobs/roles"
ansible-galaxy install -fr "${PROJECT_DIR}/ansible-collections-requirements.yml"
ansible-playbook -i "${PROJECT_DIR}/tests/hosts.ini" \
-e "tripleo_src=$(realpath --relative-to="${HOME}" "${PROJECT_DIR}")" \
-e "tripleo_validations_role_name=${ROLE_NAME}" \

View File

@ -2,7 +2,7 @@
- job:
description: Base tripleo-validations job
name: tripleo-validations-centos-8-base
nodeset: centos-8
nodeset: centos-8-stream
parent: base
success-url: "reports.html"
failure-url: "reports.html"