project-config/tox.ini
Dr. Jens Harbott 6ca813f6c8
Fix project-config testing
This is a combination of 2 commits:

Fix the renaming of ansible-role-refstack-client

In [0] that project was moved from x/ to openinfra/, but the patch
missed that at the same time refstack was also moved, changing the
path for the ACL.[1]

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

Fix use of yaml.load()

The use of this function has been deprecated for a long time[2]. With
PyYAML==6.0 the call is now failing, so replace it with the safe
version.

[2] https://msg.pyyaml.org/load

Signed-off-by: Dr. Jens Harbott <harbott@osism.tech>
Change-Id: I439d1f167b5893a134a5b628ebc00fd6617e0cbd
2021-10-18 13:23:29 +02:00

136 lines
3.9 KiB
INI

[tox]
minversion = 1.6
envlist = linters,gerrit,grafyaml
skipsdist = True
[testenv]
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
basepython = python3
[testenv:linters]
whitelist_externals = bash
setenv =
ANSIBLE_LIBRARY= {toxinidir}/tests/fake-ansible
# 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:../zuul-jobs/roles:../openstack-zuul-jobs/roles:roles}
# Add dependencies here since other jobs use python2 and zuul requires
# python3.
deps =
# ansible-lint brings in the latest version of ansible, but we
# keep this in sync with what Zuul uses so we don't allow though
# things from a later ansible that would actually fail in
# production.
ansible>=2.8,<=2.9
ansible-lint>=4.2.0,<5
hacking>=2.0.0,<2.1.0
bashate>=0.2
commands =
{toxinidir}/tools/run-bashate.sh
flake8
# Run some policy checks on zuul.d/projects.yaml
{toxinidir}/tools/zuul-projects-checks.py
# Ansible lint
bash -c "find playbooks -type f -regex '.*.ya?ml' -print0 | \
xargs -t -n1 -0 ansible-lint"
bash -c 'find roles -maxdepth 1 -mindepth 1 -type d -printf "%p/\n" | \
xargs -t -n1 ansible-lint'
# Ansible Syntax Check
bash -c "find playbooks -type f -regex '.*.ya?ml' -exec \
ansible-playbook --syntax-check -i {toxinidir}/tests/inventory \
-e @tests/vars.yaml \{\} + > /dev/null"
# Make sure site-variables at least parses
python -c 'import yaml ; yaml.safe_load(open("zuul/site-variables.yaml", "r"))'
[testenv:gerrit]
deps =
PyYAML
ruamel.yaml
GitPython
commands =
{toxinidir}/tools/check_valid_gerrit_projects.py gerrit/projects.yaml gerrit/acls zuul/main.yaml
{toxinidir}/tools/check_projects_yaml_alphabetized.sh gerrit/projects.yaml
{toxinidir}/tools/check_valid_gerrit_config.sh
[testenv:venv]
commands = {posargs}
[testenv:irc]
deps =
PyYAML
ruamel.yaml
irc
commands =
{toxinidir}/tools/check_irc_access.py -l accessbot/channels.yaml opendevaccess
{toxinidir}/tools/irc_tests.py
{toxinidir}/tools/check-channels-yaml.sh
[flake8]
show-source = True
exclude = .tox,.test
# These are ignored intentionally in openstack-infra projects;
# please don't submit patches that solely correct them or enable them.
ignore = E125,E129,E402,H,W503
[testenv:grafyaml]
deps =
{env:GRAFYAML_SRC:git+https://opendev.org/opendev/grafyaml#egg=grafyaml}
basepython = python2.7
commands = grafana-dashboard validate grafana
[testenv:bindep]
# Do not install any requirements. We want this to be fast and work even if
# system dependencies are missing, since it's used to tell you what system
# dependencies are missing! This also means that bindep must be installed
# separately, outside of the requirements files.
deps = bindep
commands = bindep test
[testenv:infra-docs]
deps =
Jinja2
PyYAML
commands = {toxinidir}/docs-site/generate_infra_index.py {toxinidir}/docs-site/infra-documents.yaml
[testenv:specs]
deps =
Jinja2
PyYAML
commands = {toxinidir}/specs/generate_specs_site.py {toxinidir}/specs/specs.yaml
[testenv:dib]
deps =
diskimage-builder
yamllint
changedir = {toxinidir}/nodepool
commands = env ELEMENTS_DIR=elements dib-lint
[testenv:nodepool]
deps = nodepool
commands =
{toxinidir}/tools/nodepool-validate.sh
[testenv:add-projects-to-main]
whitelist_externals =
git
deps =
ruamel.yaml
commands =
python tools/add-projects-to-main.py
git diff-files --quiet
[testenv:normalize-projects-yaml]
deps =
ruamel.yaml
commands =
{toxinidir}/tools/normalize_projects_yaml.py