1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/runner/docker/requirements.sh
Matt Clay 36b13e3e3d Fix ansible-test default image. (#31966)
* Add openssh-client to default docker container.
* Include Azure requirements in default container.

To do so, handling of pip requirements was updated to install each
set of requirements separately and then run a verification pass to
make sure there are no conflicts between requirements.

* Add missing --docker-no-pull option.
* Add documentation for the azure-requirements test.
2017-10-20 08:48:01 -07:00

70 lines
1.8 KiB
Bash
Executable file

#!/bin/bash -eu
python_versions=(
2.6
2.7
3.5
3.6
)
requirements=()
for requirement in *.txt; do
if [ "${requirement}" != "constraints.txt" ]; then
requirements+=("${requirement}")
fi
done
for python_version in "${python_versions[@]}"; do
version_requirements=()
for requirement in "${requirements[@]}"; do
case "${python_version}" in
"2.6")
case "${requirement}" in
"integration.cloud.azure.txt") continue ;;
esac
esac
version_requirements+=("${requirement}")
done
echo "==> Installing pip for python ${python_version} ..."
set -x
"python${python_version}" /tmp/get-pip.py -c constraints.txt
set +x
echo "==> Installing requirements for python ${python_version} ..."
for requirement in "${version_requirements[@]}"; do
set -x
"pip${python_version}" install --disable-pip-version-check -c constraints.txt -r "${requirement}"
set +x
done
echo "==> Checking for requirements conflicts for ${python_version} ..."
after=$("pip${python_version}" list)
for requirement in "${version_requirements[@]}"; do
before="${after}"
set -x
"pip${python_version}" install --disable-pip-version-check -c constraints.txt -r "${requirement}"
set +x
after=$("pip${python_version}" list)
if [ "${before}" != "${after}" ]; then
echo "==> Conflicts detected in requirements for python ${python_version}: ${requirement}"
echo ">>> Before"
echo "${before}"
echo ">>> After"
echo "${after}"
exit 1
fi
done
echo "==> Finished with requirements for python ${python_version}."
done