bifrost/tools/ansible-lint.sh
Dmitry Tantsur fd530ac5aa Support Ansible 2.10
No code changes required, but the linters job needed fixing since now
it tries to automagically load the collections in playbooks/collections
and fails with "relative resource paths not supported".

Change-Id: Ifa99a4bccc52f095c057a082fbe3d15a1633de9f
2020-11-03 11:31:14 +01:00

26 lines
792 B
Bash

#!/bin/bash
set -eu
DEST="$(dirname $0)/../.tox/linters/collections"
SOURCE="${ANSIBLE_COLLECTION_SOURCE_PATH:-../ansible-collections-openstack}"
if [ ! -d "$SOURCE" ]; then
echo "Cannot find ansible-collections-openstack at $SOURCE"
exit 1
fi
rm -f "$DEST" || true
mkdir -p "$DEST/ansible_collections/openstack"
rm -f "$DEST/ansible_collections/openstack/cloud"
ln -s "$(realpath $SOURCE)" "$DEST/ansible_collections/openstack/cloud"
export ANSIBLE_COLLECTIONS_PATHS="$(realpath $DEST)"
export ANSIBLE_LIBRARY="$(dirname $0)/../playbooks/library"
find playbooks -maxdepth 1 -type f -regex '.*.ya?ml' -print0 | \
xargs -t -n1 -0 ansible-lint -vv --nocolor
find playbooks/roles -maxdepth 1 -mindepth 1 -type d -printf "%p/\n" | \
xargs -t -n1 ansible-lint -vv --nocolor