2015-02-25 14:52:55 +01:00
|
|
|
#!/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"
|
2015-08-25 16:57:21 +02:00
|
|
|
docker run --rm \
|
|
|
|
${GIT_VOLUME} \
|
|
|
|
--entrypoint="tox" \
|
|
|
|
"$TAG" -e pre-commit
|
2015-02-25 14:52:55 +01:00
|
|
|
|
2015-09-17 00:58:34 +02:00
|
|
|
get_versions="docker run --rm
|
|
|
|
--entrypoint=/code/.tox/py27/bin/python
|
|
|
|
$TAG
|
|
|
|
/code/script/versions.py docker/docker"
|
2015-08-31 23:29:25 +02:00
|
|
|
|
2015-02-25 14:52:55 +01:00
|
|
|
if [ "$DOCKER_VERSIONS" == "" ]; then
|
2015-09-17 00:58:34 +02:00
|
|
|
DOCKER_VERSIONS="$($get_versions default)"
|
2015-02-25 14:52:55 +01:00
|
|
|
elif [ "$DOCKER_VERSIONS" == "all" ]; then
|
2016-01-16 01:04:01 +01:00
|
|
|
DOCKER_VERSIONS=$($get_versions -n 2 recent)
|
2015-02-25 14:52:55 +01:00
|
|
|
fi
|
|
|
|
|
2015-08-31 23:29:25 +02:00
|
|
|
|
|
|
|
BUILD_NUMBER=${BUILD_NUMBER-$USER}
|
|
|
|
|
2015-02-25 14:52:55 +01:00
|
|
|
for version in $DOCKER_VERSIONS; do
|
|
|
|
>&2 echo "Running tests against Docker $version"
|
2015-07-29 17:16:42 +02:00
|
|
|
|
2015-08-31 23:29:25 +02:00
|
|
|
daemon_container="compose-dind-$version-$BUILD_NUMBER"
|
|
|
|
|
2015-10-28 17:40:59 +01:00
|
|
|
function on_exit() {
|
|
|
|
if [[ "$?" != "0" ]]; then
|
2015-11-02 19:43:29 +01:00
|
|
|
docker logs "$daemon_container" 2>&1 | tail -n 100
|
2015-10-28 17:40:59 +01:00
|
|
|
fi
|
|
|
|
docker rm -vf "$daemon_container"
|
|
|
|
}
|
|
|
|
|
|
|
|
trap "on_exit" EXIT
|
2015-08-31 23:29:25 +02:00
|
|
|
|
2016-01-16 01:04:01 +01:00
|
|
|
repo="dockerswarm/dind"
|
2016-01-15 01:12:07 +01:00
|
|
|
|
2015-08-31 23:29:25 +02:00
|
|
|
docker run \
|
|
|
|
-d \
|
|
|
|
--name "$daemon_container" \
|
|
|
|
--privileged \
|
|
|
|
--volume="/var/lib/docker" \
|
2016-01-15 01:12:07 +01:00
|
|
|
"$repo:$version" \
|
2015-10-28 17:40:59 +01:00
|
|
|
docker daemon -H tcp://0.0.0.0:2375 $DOCKER_DAEMON_ARGS \
|
2015-11-02 19:43:29 +01:00
|
|
|
2>&1 | tail -n 10
|
2015-08-31 23:29:25 +02:00
|
|
|
|
|
|
|
docker run \
|
|
|
|
--rm \
|
|
|
|
--link="$daemon_container:docker" \
|
|
|
|
--env="DOCKER_HOST=tcp://docker:2375" \
|
2016-01-15 01:12:07 +01:00
|
|
|
--env="DOCKER_VERSION=$version" \
|
2015-08-31 23:29:25 +02:00
|
|
|
--entrypoint="tox" \
|
|
|
|
"$TAG" \
|
|
|
|
-e py27,py34 -- "$@"
|
|
|
|
|
2015-02-25 14:52:55 +01:00
|
|
|
done
|