Sync with travis/runcollection.sh template

Source commit in the template repo: e9f2c3a 4f3c96a
    Merge pull request #48 from nhosoi/collections
    runcollection.sh - stop passing an argument list

This change allows to eliminate the test argument list as well as the
branch name to retrieve the lsr_role2collection.py script for the
collection test.

Signed-off-by: Noriko Hosoi <nhosoi@redhat.com>
This commit is contained in:
Noriko Hosoi 2020-10-28 09:26:09 -07:00 committed by Fernando Fernández Mancera
parent c6b0226bf6
commit 18ed81168f
2 changed files with 18 additions and 6 deletions

View file

@ -13,12 +13,24 @@ SCRIPTDIR=$(readlink -f "$(dirname "$0")")
# Collection commands that are run when `tox -e collection`:
role=$(basename "${TOPDIR}")
toxworkdir=${1:-"${TOPDIR}"/.tox}
STABLE_TAG=${2:-master}
STABLE_TAG=${2:-"master"}
cd "${toxworkdir}"
toxworkdir=$(pwd)
envlist=${3:-"black,flake8,yamllint,py38,shellcheck"}
automaintenancerepo=https://raw.githubusercontent.com/linux-system-roles/auto-maintenance/
testlist="yamllint,py38"
extra="black flake8 shellcheck"
cd "${SCRIPTDIR}"
for item in ${extra}; do
for f in *"${item}"*.sh; do
if [ -f "${f}" ]; then
testlist+=",${item}"
break
fi
done
done
cd "${toxworkdir}"
automaintenancerepo=https://raw.githubusercontent.com/linux-system-roles/auto-maintenance/
curl -L -o lsr_role2collection.py "${automaintenancerepo}${STABLE_TAG}"/lsr_role2collection.py
python lsr_role2collection.py --src-path "${TOPDIR}/.." --dest-path "${toxworkdir}" --role "${role}" > "${toxworkdir}"/collection.out 2>&1
@ -27,11 +39,11 @@ yamllint="${toxworkdir}"/ansible_collections/fedora/system_roles/.yamllint_defau
sed -i -e 's/\( *\)\(document-start: disable\)/\1\2\n\1line-length:\n\1\1level: warning/' "${yamllint}"
cd ansible_collections/fedora/system_roles
tox -e "${envlist}" 2>&1 | tee "${toxworkdir}"/collection.tox.out || :
tox -e "${testlist}" 2>&1 | tee "${toxworkdir}"/collection.tox.out || :
rm -rf "${toxworkdir}"/auto-maintenance "${toxworkdir}"/ansible_collections
cd "${TOPDIR}"
res=$(grep "^ERROR: .*failed" "${toxworkdir}"/collection.tox.out || :)
res=$( grep "^ERROR: .*failed" "${toxworkdir}"/collection.tox.out || : )
if [ "$res" != "" ]; then
lsr_error "${ME}: tox in the converted collection format failed."
exit 1

View file

@ -170,7 +170,7 @@ deps =
ansible
jmespath
commands =
bash {toxinidir}/.travis/runcollection.sh {toxworkdir} master 'black,flake8,yamllint,py38'
bash {toxinidir}/.travis/runcollection.sh {toxworkdir}
[testenv:custom]
changedir = {toxinidir}