Add ansible playbooks linters job
- Execute ansible linters on ansible files - Join all linters verifications in one single job - Fixes Ansible roles and playbook to pass verification - Leave pep8 stand alone verification because of legacy OpenStack standard testing interface (required by openstack-tox-py* zuul project templates) This is intended to reduce the amount of CI jobs required to check and gate this project while adding verification for ansible playbooks and roles Change-Id: I44e03ffc8af21e798f8c7f709728a318764b328f
This commit is contained in:
parent
88cbd3847f
commit
d2741460ff
@ -1,5 +1,6 @@
|
||||
# pep8 and flake8 requirements
|
||||
|
||||
ansible-lint < 4 # MIT
|
||||
flake8==2.5.5 # MIT
|
||||
flake8-import-order==0.12 # LGPLv3
|
||||
mypy>=0.740 # MIT
|
@ -15,7 +15,11 @@
|
||||
register: found_repos
|
||||
|
||||
- name: Copy Zuul repos into devstack working directory
|
||||
command: rsync -a {{ item.path }} /opt/stack
|
||||
synchronize:
|
||||
src: "{{ item.path }}"
|
||||
dest: /opt/stack
|
||||
use_ssh_args: true
|
||||
recursive: true
|
||||
with_items: '{{ found_repos.files }}'
|
||||
become: yes
|
||||
|
||||
|
@ -11,5 +11,5 @@
|
||||
option: '{{ item.option }}'
|
||||
value: '{{ item.value }}'
|
||||
owner: root
|
||||
mode: '644'
|
||||
mode: '0644'
|
||||
loop: "{{ tobiko_conf_options }}"
|
||||
|
@ -9,5 +9,5 @@
|
||||
path: "{{ item | realpath }}"
|
||||
state: directory
|
||||
owner: '{{ tobiko_user }}'
|
||||
mode: '755'
|
||||
mode: '0755'
|
||||
loop: "{{ tobiko_output_dirs | unique }}"
|
||||
|
@ -1,16 +1,16 @@
|
||||
---
|
||||
|
||||
- name: "Check Python command '{{ python_command }}'"
|
||||
shell: "{{ python_command }} --version"
|
||||
command: "{{ python_command }} --version"
|
||||
|
||||
|
||||
- name: "Check Python command version is '{{ python_version }}'"
|
||||
shell: |
|
||||
command: |
|
||||
{{ python_command }} '{{ tobiko_dir }}/tools/ci/python_version' \
|
||||
--check-prefix
|
||||
|
||||
|
||||
- name: "Check Tox command: '{{ tox_command }}'"
|
||||
shell:
|
||||
command:
|
||||
chdir: "{{ tox_dir }}"
|
||||
cmd: "{{ tox_command }} --version"
|
||||
|
34
tox.ini
34
tox.ini
@ -1,6 +1,6 @@
|
||||
[tox]
|
||||
|
||||
envlist = pep8,pylint,py37,py27,docs
|
||||
envlist = linters,py37,docs
|
||||
minversion = 2.3.2
|
||||
|
||||
|
||||
@ -58,23 +58,29 @@ whitelist_externals =
|
||||
|
||||
# --- static analisys environments -------------------------------------------
|
||||
|
||||
[testenv:pep8]
|
||||
|
||||
commands = flake8 --max-complexity 10
|
||||
[testenv:pep8]
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
-r{toxinidir}/pep8-requirements.txt
|
||||
|
||||
|
||||
[testenv:pylint]
|
||||
|
||||
envdir = {toxworkdir}/pep8
|
||||
deps = {[testenv:pep8]deps}
|
||||
-r{toxinidir}/linters-requirements.txt
|
||||
commands =
|
||||
flake8 --max-complexity 10
|
||||
|
||||
|
||||
[testenv:linters]
|
||||
whitelist_externals = bash
|
||||
deps = {[testenv:pep8]deps}
|
||||
envdir = {toxworkdir}/pep8
|
||||
commands =
|
||||
{[testenv:pep8]commands}
|
||||
mypy --py2 --ignore-missing-imports tobiko/
|
||||
bash -c 'find roles -maxdepth 1 -mindepth 1 -type d | \
|
||||
xargs -t -n1 ansible-lint -xANSIBLE0012'
|
||||
bash -c 'find playbooks -maxdepth 1 -mindepth 1 -type f -name '*.yaml' | \
|
||||
xargs -t -n1 ansible-lint -xANSIBLE0012'
|
||||
pylint -j0 --max-line-length=80 -E -e W,E \
|
||||
-d unused-import,broad-except,fixme tobiko
|
||||
|
||||
|
||||
[flake8]
|
||||
# H106: Don't put vim configuration in source files
|
||||
# H203: Use assertIs(Not)None to check for None
|
||||
@ -88,12 +94,6 @@ exclude = ./.*,*lib/python*,build,dist,doc,*egg*,releasenotes,.venv
|
||||
import-order-style = pep8
|
||||
|
||||
|
||||
[testenv:mypy]
|
||||
deps = {[testenv:pep8]deps}
|
||||
commands =
|
||||
mypy --py2 --ignore-missing-imports tobiko/
|
||||
|
||||
|
||||
# --- integration test environments ------------------------------------------
|
||||
|
||||
[openstack]
|
||||
|
@ -1,7 +0,0 @@
|
||||
- job:
|
||||
name: tobiko-tox-mypy
|
||||
parent: openstack-tox
|
||||
description: |
|
||||
Run static mypy type checker for Tobiko project.
|
||||
vars:
|
||||
tox_envlist: mypy
|
@ -1,5 +1,6 @@
|
||||
- project:
|
||||
templates:
|
||||
- ansible-role-jobs
|
||||
- build-openstack-docs-pti
|
||||
- docs-on-readthedocs
|
||||
- openstack-cover-jobs
|
||||
@ -7,6 +8,7 @@
|
||||
- openstack-python35-jobs
|
||||
- openstack-python36-jobs
|
||||
- openstack-python37-jobs
|
||||
- openstack-python-jobs
|
||||
- publish-to-pypi
|
||||
- build-release-notes-jobs-python3
|
||||
vars:
|
||||
@ -14,9 +16,6 @@
|
||||
|
||||
check:
|
||||
jobs:
|
||||
- openstack-tox-pylint
|
||||
- tobiko-tox-mypy
|
||||
|
||||
- tobiko-devstack-functional
|
||||
- tobiko-devstack-scenario
|
||||
- tobiko-devstack-faults-centos-7
|
||||
@ -30,8 +29,3 @@
|
||||
- tobiko-devstack-ovn-faults-centos-7
|
||||
- tobiko-devstack-ovn-faults-centos-7-queens
|
||||
- tobiko-devstack-ovn-faults-ubuntu-bionic
|
||||
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-tox-pylint
|
||||
- tobiko-tox-mypy
|
||||
|
Loading…
x
Reference in New Issue
Block a user