Skip to content
Snippets Groups Projects
Commit 23faa83a authored by Rafael Guterres Jeffman's avatar Rafael Guterres Jeffman
Browse files

sanity.sh: Allow use of podman instead of docker

When running tests/sanity/sanity.sh locally, podman might be available
instead of Docker. Due to current configuration, only Docker is used by
sanity.sh.

This patch searches for the availability of docker, which is kept as
the default container engine to use, and use podman only if docker is
not found.

This change also allows the execution of the script from a directory
other than the repository root.
parent 9dcff9a3
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
TOPDIR=$(readlink -f "$(dirname "$0")/../..")
pushd "${TOPDIR}" >/dev/null || exit 1
VENV=/tmp/ansible-test-venv VENV=/tmp/ansible-test-venv
ANSIBLE_COLLECTION=freeipa-ansible_freeipa ANSIBLE_COLLECTION=freeipa-ansible_freeipa
use_docker=$(which docker >/dev/null 2>&1 && echo "True" || echo "False")
virtualenv "$VENV" virtualenv "$VENV"
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source "$VENV"/bin/activate source "$VENV"/bin/activate
...@@ -15,7 +20,8 @@ rm -f importer_result.json ...@@ -15,7 +20,8 @@ rm -f importer_result.json
utils/build-galaxy-release.sh utils/build-galaxy-release.sh
export GALAXY_IMPORTER_CONFIG=tests/sanity/galaxy-importer.cfg sed "s/LOCAL_IMAGE_DOCKER = True/LOCAL_IMAGE_DOCKER = ${use_docker}/" < tests/sanity/galaxy-importer.cfg > ${VENV}/galaxy-importer.cfg
export GALAXY_IMPORTER_CONFIG=${VENV}/galaxy-importer.cfg
collection=$(ls -1 "$ANSIBLE_COLLECTION"-*.tar.gz) collection=$(ls -1 "$ANSIBLE_COLLECTION"-*.tar.gz)
echo "Running: python -m galaxy_importer.main $collection" echo "Running: python -m galaxy_importer.main $collection"
...@@ -33,4 +39,6 @@ done < <(python -m galaxy_importer.main "$collection") ...@@ -33,4 +39,6 @@ done < <(python -m galaxy_importer.main "$collection")
rm -rf "$VENV" rm -rf "$VENV"
popd >/dev/null || exit 1
exit "$error" exit "$error"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment