Merge "linters: update to ansible-lint 6"
This commit is contained in:
commit
63fe939376
@ -12,5 +12,12 @@ skip_list:
|
|||||||
- '306'
|
- '306'
|
||||||
- '106'
|
- '106'
|
||||||
- '208'
|
- '208'
|
||||||
|
- fqcn-builtins # needs a lot of work
|
||||||
|
- yaml[line-length] # we use good taste with long lines
|
||||||
|
- yaml[truthy] # "yes" is ok
|
||||||
use_default_rules: true
|
use_default_rules: true
|
||||||
verbosity: 1
|
verbosity: 1
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# mode: yaml
|
||||||
|
# End:
|
||||||
|
@ -5,6 +5,6 @@
|
|||||||
hacking>=4.0.0,<5.0.0 # Apache-2.0
|
hacking>=4.0.0,<5.0.0 # Apache-2.0
|
||||||
|
|
||||||
# ansible-lint requires ansible>=2.9
|
# ansible-lint requires ansible>=2.9
|
||||||
ansible>=2.9.0,<2.10
|
ansible>=5,<6
|
||||||
ansible-lint>=5.0.0,<6.0.0
|
ansible-lint>=6,<7
|
||||||
bashate>=0.2
|
bashate>=0.2
|
||||||
|
38
tools/ansible-lint-roles-cache.sh
Executable file
38
tools/ansible-lint-roles-cache.sh
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This is a bit lame, but if we're running under Zuul then this is set
|
||||||
|
# to the zuul checkouts of the required roles, so no need to do
|
||||||
|
# anything here.
|
||||||
|
if [[ ! ${ANSIBLE_ROLES_PATH} =~ \.cache.* ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d .cache/ansible-lint ]; then
|
||||||
|
mkdir -p .cache/ansible-lint
|
||||||
|
fi
|
||||||
|
|
||||||
|
pushd .cache/ansible-lint
|
||||||
|
|
||||||
|
repos=(opendev/base-jobs
|
||||||
|
opendev/system-config
|
||||||
|
openstack/openstack-zuul-jobs
|
||||||
|
zuul/zuul-jobs)
|
||||||
|
|
||||||
|
for repo in ${repos[@]}; do
|
||||||
|
dir=$(dirname $repo)
|
||||||
|
echo "Updating Ansible roles repo ${dir}"
|
||||||
|
if [ ! -d $repo ]; then
|
||||||
|
echo "Cloning fresh"
|
||||||
|
mkdir -p $dir
|
||||||
|
pushd $dir
|
||||||
|
git clone https://opendev.org/$repo
|
||||||
|
popd
|
||||||
|
else
|
||||||
|
echo "Updating repo"
|
||||||
|
pushd $repo
|
||||||
|
git fetch -a
|
||||||
|
git pull
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
echo "Done"
|
||||||
|
done
|
15
tox.ini
15
tox.ini
@ -23,19 +23,16 @@ commands =
|
|||||||
|
|
||||||
[testenv:linters]
|
[testenv:linters]
|
||||||
whitelist_externals = bash
|
whitelist_externals = bash
|
||||||
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
|
|
||||||
setenv =
|
setenv =
|
||||||
ANSIBLE_LIBRARY= {toxinidir}/tests/fake-ansible
|
# NOTE(ianw) : In the gate job openstack-zuul-jobs-linters this is
|
||||||
|
# overridden to the Zuul checkouts of the projects. Locally,
|
||||||
|
# tools/ansible-lint-roles-cache.sh will populate these for the
|
||||||
|
# linter.
|
||||||
|
ANSIBLE_ROLES_PATH={env:ANSIBLE_ROLES_PATH:{toxinidir}/.cache/ansible-lint/opendev/base-jobs/roles:{toxinidir}/.cache/ansible-lint/opendev/system-config/roles:{toxinidir}/.cache/ansible-lint/zuul/zuul-jobs/roles:{toxinidir}/.cache/ansible-lint/openstack/openstack-zuul-jobs/roles}
|
||||||
commands =
|
commands =
|
||||||
flake8 {posargs}
|
flake8 {posargs}
|
||||||
|
{toxinidir}/tools/ansible-lint-roles-cache.sh
|
||||||
ansible-lint
|
ansible-lint
|
||||||
# Ansible Syntax Check
|
|
||||||
bash -c "cd playbooks; find . -type f -regex '.*.y[a]?ml' -exec \
|
|
||||||
ansible-playbook --syntax-check -i {toxinidir}/tests/inventory \{\} + > /dev/null"
|
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
Loading…
Reference in New Issue
Block a user