compose/script/test-versions

53 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# This should be run inside a container built from the Dockerfile
# at the root of the repo - script/test will do it automatically.
set -e
>&2 echo "Running lint checks"
docker run --rm \
${GIT_VOLUME} \
--entrypoint="tox" \
"$TAG" -e pre-commit
get_versions="docker run --rm
--entrypoint=/code/.tox/py27/bin/python
$TAG
/code/script/versions.py docker/docker"
if [ "$DOCKER_VERSIONS" == "" ]; then
DOCKER_VERSIONS="$($get_versions default)"
elif [ "$DOCKER_VERSIONS" == "all" ]; then
DOCKER_VERSIONS="$($get_versions recent -n 2)"
fi
BUILD_NUMBER=${BUILD_NUMBER-$USER}
for version in $DOCKER_VERSIONS; do
>&2 echo "Running tests against Docker $version"
daemon_container="compose-dind-$version-$BUILD_NUMBER"
trap "docker rm -vf $daemon_container" EXIT
# TODO: remove when we stop testing against 1.7.x
daemon=$([[ "$version" == "1.7"* ]] && echo "-d" || echo "daemon")
docker run \
-d \
--name "$daemon_container" \
--privileged \
--volume="/var/lib/docker" \
dockerswarm/dind:$version \
docker $daemon -H tcp://0.0.0.0:2375 $DOCKER_DAEMON_ARGS \
docker run \
--rm \
--link="$daemon_container:docker" \
--env="DOCKER_HOST=tcp://docker:2375" \
--entrypoint="tox" \
"$TAG" \
-e py27,py34 -- "$@"
done