openstack-zuul-jobs/tools/ansible-lint-roles-cache.sh
Ian Wienand 34a45ddb78 linters: update to ansible-lint 6
This updates to ansible-lint 6.  Similar to
I972f73037b9f904a555b81f3835ca5261639ed01 it provides a helper for
installing required roles for linting.

There is no need for a separate syntax checking step, as that is done
by ansible-lint.

Change-Id: I270c50bd5b3ac8db583bc2ba48e254175c91db03
2022-07-28 15:24:38 +10:00

39 lines
843 B
Bash
Executable File

#!/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