test-versions 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. # This should be run inside a container built from the Dockerfile
  3. # at the root of the repo - script/test will do it automatically.
  4. set -e
  5. >&2 echo "Running lint checks"
  6. docker run --rm \
  7. ${GIT_VOLUME} \
  8. --entrypoint="tox" \
  9. "$TAG" -e pre-commit
  10. ALL_DOCKER_VERSIONS="1.7.1 1.8.2"
  11. DEFAULT_DOCKER_VERSION="1.8.2"
  12. if [ "$DOCKER_VERSIONS" == "" ]; then
  13. DOCKER_VERSIONS="$DEFAULT_DOCKER_VERSION"
  14. elif [ "$DOCKER_VERSIONS" == "all" ]; then
  15. DOCKER_VERSIONS="$ALL_DOCKER_VERSIONS"
  16. fi
  17. BUILD_NUMBER=${BUILD_NUMBER-$USER}
  18. for version in $DOCKER_VERSIONS; do
  19. >&2 echo "Running tests against Docker $version"
  20. daemon_container="compose-dind-$version-$BUILD_NUMBER"
  21. trap "docker rm -vf $daemon_container" EXIT
  22. # TODO: remove when we stop testing against 1.7.x
  23. daemon=$([[ "$version" == "1.7"* ]] && echo "-d" || echo "daemon")
  24. docker run \
  25. -d \
  26. --name "$daemon_container" \
  27. --privileged \
  28. --volume="/var/lib/docker" \
  29. dockerswarm/dind:$version \
  30. docker $daemon -H tcp://0.0.0.0:2375 $DOCKER_DAEMON_ARGS \
  31. docker run \
  32. --rm \
  33. --link="$daemon_container:docker" \
  34. --env="DOCKER_HOST=tcp://docker:2375" \
  35. --entrypoint="tox" \
  36. "$TAG" \
  37. -e py27,py34 -- "$@"
  38. done