base-jobs/tox.ini
Clark Boylan 7bd42d37c4 Fixup CI jobs
Several things have bit rotted in here that we need to take care of.

First is that we updated the default nodeset to Noble which breaks our
ability to install Pillow<10 for blockdiag. To fix this we need to
install libjpeg-dev so that we can build a Pillow wheel locally during
testing.

Next old ansible-lint doesn't run on Noble's python3.12. We bump up
Ansible lint to a modern version that matches Zuul's current default
Ansible. We also stop installing zuul to get zuul_console and
zuul_return and instead simply mock them in the linter. To make this
work we have to drop the ansible-playbook syntax check run which is fine
because ansible-lint runs this too, but when done via ansible-lint the
mocked modules are respected [0].

Finally we have to clean up/ignore some of the new linter
warnings/errors.

[0] https://ansible.readthedocs.io/projects/lint/rules/syntax-check/

Change-Id: Ia0e936fefc9e2b0f2fa614c93a2f168e14b2825b
2024-09-19 14:18:01 -07:00

54 lines
1.5 KiB
INI

[tox]
minversion = 1.6
skipsdist = True
envlist = linters
[testenv]
basepython = python3
install_command = pip install {opts} {packages}
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run {posargs}
stestr slowest
[testenv:py27]
basepython = python2.7
[testenv:docs]
commands =
sphinx-build -E -W -d doc/build/doctrees -b html doc/source/ doc/build/html
[testenv:linters]
setenv =
# NOTE(pabelanger): if you'd like to run tox -elinters locally,
# you'll need to export ANSIBLE_ROLES_PATH pointing to the required
# repos.
#
# We take a guess that zuul-jobs and openstack-zuul-jobs will be
# checked out in the directory above us (i.e. alongside
# project-config). You may need to override this. Make sure
# they're up to date too!
#
# see openstack-zuul-jobs-linters job for more information.
ANSIBLE_ROLES_PATH = {env:ANSIBLE_ROLES_PATH:{toxinidir}/../../zuul/zuul-jobs/roles:roles}
allowlist_externals =
bash
{toxinidir}/tools/check_jobs_documented.py
commands =
flake8 {posargs}
{toxinidir}/tools/check_jobs_documented.py
# Ansible lint
ansible-lint -v
[testenv:venv]
commands = {posargs}
[flake8]
# These are ignored intentionally in openstack-infra projects;
# please don't submit patches that solely correct them or enable them.
# E402 - ansible modules put documentation before imports. Align to ansible.
# W504 - line break after binary operator, we cannot have both
# W503 and W504 enabled
ignore = E125,E129,E402,E741,W504,H
show-source = True
exclude = .venv,.tox,dist,doc,build,*.egg