project-config/tox.ini
Colleen Murphy 2fd1a55e63 Fix ansible-lint job
The 'linters' tox environment was not running on roles, it was only
running on playbooks. This change adds a command to the linters
environment to ensure all roles are linted. This also cleans up a
comment in the tox file that was referring to a nonexistent zuul job.

Change-Id: I04d9d79fca16a7f78f9c646f96e5fba78a5f5329
2018-03-29 15:35:19 +02:00

119 lines
3.4 KiB
INI

[tox]
minversion = 1.6
envlist = linters,gerrit,grafyaml
skipsdist = True
[testenv]
deps = -r{toxinidir}/test-requirements.txt
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
[testenv:linters]
basepython = python3
whitelist_externals = bash
setenv =
ANSIBLE_LIBRARY= {envdir}/src/zuul/zuul/ansible/library
passenv =
# NOTE(pabelanger): if you'd like to run tox -elinters locally, you'll need
# to export ANSIBLE_ROLES_PATH pointing to the currect repos.
# see openstack-zuul-jobs-linters job for more information.
ANSIBLE_ROLES_PATH
# Add dependencies here since other jobs use python2 and zuul requires
# python3.
deps =
# Zuul is required to supply the zuul ansible modules for ansible-lint
-egit+https://git.openstack.org/openstack-infra/zuul#egg=zuul
ansible<2.4.0
ansible-lint
hacking>=0.10,<0.11
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
# [ANSIBLE0012] Commands should not change things if nothing needs doing
bash -c "find playbooks -type f -regex '.*.ya?ml' -print0 | \
xargs -t -n1 -0 ansible-lint -xANSIBLE0012"
bash -c 'find roles -maxdepth 1 -mindepth 1 -type d -printf "%p/\n" | \
xargs -t -n1 ansible-lint -xANSIBLE0012'
# 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"
[testenv:gerrit]
deps = PyYAML
GitPython
commands =
{toxinidir}/tools/check_valid_gerrit_projects.py gerrit/projects.yaml gerrit/acls
{toxinidir}/tools/check_projects_yaml_alphabetized.sh gerrit/projects.yaml
{toxinidir}/tools/check_valid_gerrit_config.sh gerrit/acls/
{toxinidir}/tools/check_gerrit_projects_changed.sh
[testenv:venv]
commands = {posargs}
[testenv:docs]
commands = python setup.py build_sphinx
[testenv:irc]
deps = PyYAML
irc
commands =
{toxinidir}/tools/check_irc_access.py -l accessbot/channels.yaml openstackinfra
{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]
basepython = python2.7
commands = {toxinidir}/tools/grafyaml-validate.sh
[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
changedir = {toxinidir}/nodepool
commands = env ELEMENTS_DIR=elements dib-lint
[testenv:nodepool]
basepython = python3
commands =
{toxinidir}/tools/nodepool-validate.sh
[testenv:add-projects-to-main]
basepython = python3
whitelist_externals =
git
deps =
ruamel.yaml
commands =
python tools/add-projects-to-main.py
git diff-files --quiet