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 }} FROM {{ item.image }}
{% endif %} {% endif %}
RUN dnf makecache && dnf install -y sudo python*-devel python*-dnf bash {{ item.pkg_extras | default('') }} RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
# TODO(gchamoul): find a better to get always the latest version of those rpms 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; \
# below from the centos mirror 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; \
RUN dnf install -y http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8-2.el8.noarch.rpm elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \
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 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([]) %} {% for pkg in item.easy_install | default([]) %}
# install pip for centos where there is no python-pip rpm in default repos # install pip for centos where there is no python-pip rpm in default repos
RUN easy_install {{ pkg }} RUN easy_install {{ pkg }}
{% endfor %} {% endfor %}
CMD ["sh", "-c", "while true; do sleep 10000; done"] 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 # you will have to redefine them completely in your molecule.yml (at the role
# level) and add your extra configuration! # level) and add your extra configuration!
# #
# For instance, if you need to add an extra package in your ubi8 container, you # For instance, if you need to add an extra package in your CentOS 8 Stream
# will have to add the entire "platforms" key into your molecule.yml file and # container, you will have to add the entire "platforms" key into your
# add your package name in the pkg_extras key. # 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 # No merge will happen between your molecule.yml and this config.yml
# files. That's why you will have to redefine them completely. # files. That's why you will have to redefine them completely.
@ -25,11 +25,11 @@ driver:
log: true log: true
platforms: platforms:
- name: ubi8 - name: centos
hostname: ubi8 hostname: centos
image: ubi8/ubi-init image: centos/centos:stream8
registry: registry:
url: registry.access.redhat.com url: quay.io
dockerfile: ../../../../../.config/molecule/Dockerfile dockerfile: ../../../../../.config/molecule/Dockerfile
pkg_extras: python*-setuptools python*-pyyaml pkg_extras: python*-setuptools python*-pyyaml
volumes: volumes:
@ -47,7 +47,7 @@ provisioner:
hosts: hosts:
all: all:
hosts: hosts:
ubi8: centos:
ansible_python_interpreter: /usr/bin/python3 ansible_python_interpreter: /usr/bin/python3
log: true log: true
options: options:
@ -67,4 +67,4 @@ scenario:
- destroy - destroy
verifier: verifier:
name: testinfra name: ansible

View File

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

View File

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

View File

@ -25,6 +25,13 @@
virtualenv_command: "{{ ensure_pip_virtualenv_command }}" virtualenv_command: "{{ ensure_pip_virtualenv_command }}"
virtualenv_site_packages: true 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 - name: Run bindep
shell: |- shell: |-
. {{ ansible_user_dir }}/test-python/bin/activate . {{ 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} sudo "${RHT_PKG_MGR}" install -y ${BINDEP_PKGS}
;; ;;
esac esac
fi fi

View File

@ -2,6 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
ansible-core<2.12 # GPLv3+
coverage!=4.4,>=4.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0
stestr>=3.0.1 # 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}/requirements.txt
-r {toxinidir}/test-requirements.txt -r {toxinidir}/test-requirements.txt
-r {toxinidir}/doc/requirements.txt -r {toxinidir}/doc/requirements.txt
ansible-core<2.12 # GPLv3+
whitelist_externals = whitelist_externals =
bash bash
ansible-galaxy ansible-galaxy
@ -59,7 +58,6 @@ deps =
-c {env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/train} -c {env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/train}
-r {toxinidir}/requirements.txt -r {toxinidir}/requirements.txt
-r {toxinidir}/test-requirements.txt -r {toxinidir}/test-requirements.txt
ansible-core<2.12
whitelist_externals = whitelist_externals =
bash bash
cp cp
@ -90,7 +88,6 @@ deps =
commands = commands =
bash -c "ANSIBLE_ROLES_PATH='{toxinidir}/validations_common/roles'" bash -c "ANSIBLE_ROLES_PATH='{toxinidir}/validations_common/roles'"
bash -c "ANSIBLE_LIBRARY='{toxinidir}/validations_common/library'" 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 python -m pre_commit run ansible-lint -a
[testenv:yamllint] [testenv:yamllint]
@ -117,12 +114,19 @@ deps = {[testenv:linters]deps}
commands = commands =
python -m pre_commit run check-executables-have-shebangs -a 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] [testenv:linters]
commands_pre =
ansible-galaxy install -fr {toxinidir}/ansible-collections-requirements.yml
deps = deps =
-c {env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -c {env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r {toxinidir}/requirements.txt -r {toxinidir}/requirements.txt
-r {toxinidir}/test-requirements.txt -r {toxinidir}/test-requirements.txt
ansible-core<2.12 # GPLv3+
commands = commands =
python '{toxinidir}/tools/validate-files.py' . python '{toxinidir}/tools/validate-files.py' .
{[testenv:ansible-lint]commands} {[testenv:ansible-lint]commands}
@ -130,6 +134,7 @@ commands =
{[testenv:bashate]commands} {[testenv:bashate]commands}
{[testenv:whitespace]commands} {[testenv:whitespace]commands}
{[testenv:shebangs]commands} {[testenv:shebangs]commands}
{[testenv:end-of-file]commands}
[testenv:releasenotes] [testenv:releasenotes]
deps = -r {toxinidir}/doc/requirements.txt 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 sphinx-build -a -E -W -d doc/build/doctrees --keep-going -b html doc/source doc/build/html -T
doc8 doc doc8 doc
[testenv:pdf-docs] [pdf-docs]
whitelist_externals = make whitelist_externals = make
description = description =
Build PDF documentation. Build PDF documentation.
envdir = {toxworkdir}/docs envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps} deps = {[docs]deps}
commands = commands =
sphinx-build -b latex doc/source doc/build/pdf sphinx-build -b latex doc/source doc/build/pdf
make -C doc/build/pdf make -C doc/build/pdf
@ -178,5 +183,9 @@ ignore = D001
[ansible] [ansible]
description = Used as base for all tox-ansible environments description = Used as base for all tox-ansible environments
scenario_format = $parent-$nondefault_name 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 = molecule_opts =
--debug --debug

View File

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

View File

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

View File

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