Molecule test restoration

Setting molecule to use centos8 stream instead of UBI8.
Changing nodeset of the CI jobs to centos8 stream.

Also reenables the end-of-file-fixer and simplifies testenvs

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I9da5b306d59e1aab3b9fd9d9db7294b1c69655be
This commit is contained in:
Jiri Podivin 2022-01-12 12:31:20 +01:00 committed by Gael Chamoulaud (Strider)
parent 558200c8d8
commit ae303b9aae
No known key found for this signature in database
GPG Key ID: 4119D0305C651D66
12 changed files with 56 additions and 38 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:
@ -67,4 +67,4 @@ scenario:
- destroy
verifier:
name: testinfra
name: ansible

View File

@ -19,7 +19,7 @@
- job:
name: validations-common-reqcheck
nodeset: centos-8
nodeset: centos-8-stream
parent: base
run: playbooks/reqcheck.yaml
timeout: 1600
@ -30,7 +30,7 @@
- ^requirements.txt$
- job:
name: validations-common-coverchange
nodeset: centos-8
nodeset: centos-8-stream
parent: base
run: playbooks/coverchange.yaml
timeout: 1600
@ -43,7 +43,7 @@
- job:
description: Base validations-common job
name: validations-common-centos-8-base
nodeset: centos-8
nodeset: centos-8-stream
parent: base
success-url: "reports.html"
failure-url: "reports.html"

View File

@ -173,4 +173,3 @@
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

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

@ -42,4 +42,4 @@ if [[ ${#BINDEP_PKGS} > 0 ]]; then
sudo "${RHT_PKG_MGR}" install -y ${BINDEP_PKGS}
;;
esac
fi
fi

View File

@ -2,6 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
ansible-core<2.12 # GPLv3+
coverage!=4.4,>=4.0 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0
stestr>=3.0.1 # Apache-2.0

View File

@ -1 +1 @@
test ansible_connection=local ansible_host=localhost
test ansible_connection=local ansible_host=localhost

21
tox.ini
View File

@ -39,7 +39,6 @@ deps =
-r {toxinidir}/requirements.txt
-r {toxinidir}/test-requirements.txt
-r {toxinidir}/doc/requirements.txt
ansible-core<2.12 # GPLv3+
whitelist_externals =
bash
ansible-galaxy
@ -59,7 +58,6 @@ deps =
-c {env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/train}
-r {toxinidir}/requirements.txt
-r {toxinidir}/test-requirements.txt
ansible-core<2.12
whitelist_externals =
bash
cp
@ -90,7 +88,6 @@ deps =
commands =
bash -c "ANSIBLE_ROLES_PATH='{toxinidir}/validations_common/roles'"
bash -c "ANSIBLE_LIBRARY='{toxinidir}/validations_common/library'"
ansible-galaxy install -fr {toxinidir}/ansible-collections-requirements.yml
python -m pre_commit run ansible-lint -a
[testenv:yamllint]
@ -117,12 +114,19 @@ deps = {[testenv:linters]deps}
commands =
python -m pre_commit run check-executables-have-shebangs -a
[testenv:end-of-file]
envdir = {toxworkdir}/linters
deps = {[testenv:linters]deps}
commands =
python -m pre_commit run end-of-file-fixer -a
[testenv:linters]
commands_pre =
ansible-galaxy install -fr {toxinidir}/ansible-collections-requirements.yml
deps =
-c {env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r {toxinidir}/requirements.txt
-r {toxinidir}/test-requirements.txt
ansible-core<2.12 # GPLv3+
commands =
python '{toxinidir}/tools/validate-files.py' .
{[testenv:ansible-lint]commands}
@ -130,6 +134,7 @@ commands =
{[testenv:bashate]commands}
{[testenv:whitespace]commands}
{[testenv:shebangs]commands}
{[testenv:end-of-file]commands}
[testenv:releasenotes]
deps = -r {toxinidir}/doc/requirements.txt
@ -160,12 +165,12 @@ commands=
sphinx-build -a -E -W -d doc/build/doctrees --keep-going -b html doc/source doc/build/html -T
doc8 doc
[testenv:pdf-docs]
[pdf-docs]
whitelist_externals = make
description =
Build PDF documentation.
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
deps = {[docs]deps}
commands =
sphinx-build -b latex doc/source doc/build/pdf
make -C doc/build/pdf
@ -178,5 +183,9 @@ ignore = D001
[ansible]
description = Used as base for all tox-ansible environments
scenario_format = $parent-$nondefault_name
deps =
-c {env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r {toxinidir}/requirements.txt
-r {toxinidir}/test-requirements.txt
molecule_opts =
--debug

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: centos8
hostname: centos8
image: centos/centos:stream8
registry:
url: registry.access.redhat.com
url: quay.io
dockerfile: ../../../../../.config/molecule/Dockerfile
command: /sbin/init
pkg_extras: python*-setuptools python*-pyyaml

View File

@ -6,11 +6,11 @@ driver:
name: docker
platforms:
- name: ubi8
hostname: ubi8
image: ubi8/ubi-init
- name: centos8
hostname: centos8
image: centos/centos:stream8
registry:
url: registry.access.redhat.com
url: quay.io
dockerfile: ../../../../../.config/molecule/Dockerfile
pkg_extras: python*-setuptools python*-pyyaml python*-libselinux
command: /sbin/init

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: centos8
hostname: centos8
image: centos/centos:stream8
registry:
url: registry.access.redhat.com
url: quay.io
dockerfile: ../../../../../.config/molecule/Dockerfile
pkg_extras: python*-setuptools python*-pyyaml
volumes: