1
0
mirror of https://github.com/distribution/distribution synced 2024-11-12 05:45:51 +01:00
distribution/contrib/docker-integration/run_multiversion.sh
Aaron Lehmann 1368e2ac53 Change run_multiversion.sh to get Docker engine versions from dind container
This is much better than downloading the builds with curl, because
Docker is intelligent about only pulling what it needs.

We use tagged versions of dind for the released version, and dind-master
for a master build.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-30 15:39:19 -07:00

55 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Run the integration tests with multiple versions of the Docker engine
set -e
set -x
# Don't use /tmp because this isn't available in boot2docker
tmpdir_template="`pwd`/docker-versions.XXXXX"
tmpdir=`mktemp -d "$tmpdir_template"`
trap "rm -rf $tmpdir" EXIT
# If DOCKER_VOLUME is unset, create a temporary directory to cache containers
# between runs
# Only do this on Linux, because using /var/lib/docker from a host volume seems
# problematic with boot2docker.
if [ "$DOCKER_VOLUME" = "" -a `uname` = "Linux" ]; then
volumes_template="`pwd`/docker-versions.XXXXX"
volume=`mktemp -d "$volumes_template"`
trap "rm -rf $tmpdir $volume" EXIT
else
volume="$DOCKER_VOLUME"
fi
# Released versions
versions="1.6.0 1.6.1 1.7.0 1.7.1"
for v in $versions; do
echo "Extracting Docker $v from dind image"
binpath="$tmpdir/docker-$v/docker"
ID=$(docker create dockerswarm/dind:$v)
docker cp "$ID:/usr/local/bin/docker" "$tmpdir/docker-$v"
echo "Running tests with Docker $v"
DOCKER_BINARY="$binpath" DOCKER_VOLUME="$volume" ./run.sh
# Cleanup.
docker rm -f "$ID"
done
# Latest experimental version
echo "Extracting Docker master from dind image"
binpath="$tmpdir/docker-master/docker"
docker pull dockerswarm/dind-master
ID=$(docker create dockerswarm/dind-master)
docker cp "$ID:/usr/local/bin/docker" "$tmpdir/docker-master"
echo "Running tests with Docker master"
DOCKER_BINARY="$binpath" DOCKER_VOLUME="$volume" ./run.sh
# Cleanup.
docker rm -f "$ID"