Support podman for test setup
Currently the docker based test setup requires the docker cli and docker-compose. However on systems that only use podman this doesn't work. While there is a docker cli wrapper for podman docker-compose doesn't work together with podman. However there is also podman-compose which supports the same docker-compose yaml files. Thus adapt the script such that it finds either the docker or podman executables and uses them. Change-Id: I2d1c5e1713c51de376653b35266819fd380e8891
This commit is contained in:
parent
a7fa150e21
commit
2facdf1033
|
@ -4,10 +4,36 @@ set -eu
|
||||||
|
|
||||||
cd $(dirname $0)
|
cd $(dirname $0)
|
||||||
|
|
||||||
MYSQL="docker exec zuul-test-mysql mysql -u root -pinsecure_slave"
|
# Select docker or podman
|
||||||
|
if command -v docker > /dev/null; then
|
||||||
|
DOCKER=docker
|
||||||
|
elif command -v podman > /dev/null; then
|
||||||
|
DOCKER=podman
|
||||||
|
else
|
||||||
|
echo "Please install docker or podman."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
docker-compose rm -sf
|
# Select docker-compose or podman-compose
|
||||||
docker-compose up -d
|
if command -v docker-compose > /dev/null; then
|
||||||
|
COMPOSE=docker-compose
|
||||||
|
elif command -v podman-compose > /dev/null; then
|
||||||
|
COMPOSE=podman-compose
|
||||||
|
else
|
||||||
|
echo "Please install docker-compose or podman-compose."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
MYSQL="${DOCKER} exec zuul-test-mysql mysql -u root -pinsecure_slave"
|
||||||
|
|
||||||
|
if [ "${COMPOSE}" == "docker-compose" ]; then
|
||||||
|
docker-compose rm -sf
|
||||||
|
else
|
||||||
|
podman-compose down
|
||||||
|
fi
|
||||||
|
|
||||||
|
${COMPOSE} up -d
|
||||||
|
|
||||||
echo "Waiting for mysql"
|
echo "Waiting for mysql"
|
||||||
timeout 30 bash -c "until ${MYSQL} -e 'show databases'; do sleep 0.5; done"
|
timeout 30 bash -c "until ${MYSQL} -e 'show databases'; do sleep 0.5; done"
|
||||||
|
|
Loading…
Reference in New Issue