StarlingX Zuul playbooks, roles and related scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
3.4KB

  1. [tox]
  2. minversion = 1.6
  3. skipsdist = True
  4. envlist = linters
  5. [testenv]
  6. basepython = python3
  7. install_command = pip install {opts} {packages}
  8. deps = -r{toxinidir}/test-requirements.txt
  9. [testenv:bindep]
  10. # Do not install any requirements. We want this to be fast and work even if
  11. # system dependencies are missing, since it's used to tell you what system
  12. # dependencies are missing! This also means that bindep must be installed
  13. # separately, outside of the requirements files.
  14. deps = bindep
  15. commands = bindep test
  16. [testenv:docs]
  17. whitelist_externals = bash
  18. commands =
  19. bash -c 'if [ -d doc ]; then \
  20. python setup.py build_sphinx; \
  21. fi'
  22. [testenv:linters]
  23. whitelist_externals = bash
  24. passenv =
  25. # NOTE(pabelanger): if you'd like to run tox -elinters locally, you'll need
  26. # to export ANSIBLE_ROLES_PATH pointing to the currect repos.
  27. # see openstack-zuul-jobs-linters job for more information.
  28. ANSIBLE_ROLES_PATH
  29. setenv =
  30. ANSIBLE_LIBRARY= {envsitepackagesdir}/zuul/ansible/base/library
  31. ANSIBLE_ACTION_PLUGINS = {envsitepackagesdir}/zuul/ansible/base/actiongeneral
  32. commands =
  33. flake8 {posargs}
  34. # Ansible lint
  35. # [ANSIBLE0012] Commands should not change things if nothing needs doing
  36. bash -c 'if [ -d playbooks ]; then \
  37. find playbooks -type f -regex ".*\.ya?ml" -print0 | xargs -t -n1 -0 \
  38. ansible-lint -xANSIBLE0012; \
  39. fi'
  40. bash -c 'if [ -d roles ]; then \
  41. find roles -maxdepth 1 -mindepth 1 -type d -printf "%p/\n" | xargs -t -n1 \
  42. ansible-lint -xANSIBLE0012; \
  43. fi'
  44. # Ansible Syntax Check
  45. bash -c 'if [ -d playbooks ]; then \
  46. find playbooks -type f -regex ".*\.ya?ml" -print0 | xargs -t -n1 -0 \
  47. ansible-playbook --syntax-check -i {toxinidir}/tests/inventory; \
  48. fi'
  49. # Check Shell Scripts Syntax
  50. bash -c 'if [ -d scripts ]; then \
  51. find {toxinidir} \
  52. -not \( -type d -name .?\* -prune \) \
  53. -type f \
  54. -not -name \*~ \
  55. -not -name \*.md \
  56. \( \
  57. -name \*.sh \
  58. -or -not -wholename \*/devstack/files/\* \
  59. -wholename \*/devstack/\* \
  60. \) \
  61. -print0 | xargs -t -n1 -0 \
  62. bashate -v -iE006; \
  63. fi'
  64. [testenv:venv]
  65. commands = {posargs}
  66. [flake8]
  67. # These are ignored intentionally in openstack-infra projects;
  68. # please don't submit patches that solely correct them or enable them.
  69. ignore = E125,E129,H
  70. show-source = True
  71. exclude = .venv,.tox,dist,doc,build,*.egg
  72. [testenv:pep8]
  73. basepython = python3
  74. usedevelop = False
  75. skip_install = True
  76. deps =
  77. hacking
  78. flake8-bugbear<=19.3.0
  79. flake8<3.6.0
  80. commands =
  81. flake8
  82. [testenv:rpm-packaging-lint]
  83. basepython = python3
  84. setenv =
  85. VIRTUAL_ENV={envdir}
  86. LC_ALL=en_US.utf-8
  87. install_command = pip install -U \
  88. -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
  89. {opts} {packages}
  90. deps = -r{toxinidir}/test-requirements.txt
  91. whitelist_externals = bash
  92. commands =
  93. bash -c 'if [ -d {toxinidir}/../zuul-jobs ]; then jobsdir={toxinidir}/../zuul-jobs; \
  94. else jobsdir={toxinidir}/../stx-zuul-jobs; \
  95. fi; \
  96. find . \
  97. -not \( -type d -name .?\* -prune \) \
  98. -not \( -type d -name centos -prune \) \
  99. -type f -name \*.spec \
  100. -print0 | xargs -t -0 $jobsdir/tools/spec-tools/speclint.sh'