From 70ec7a5e28f970b17b7d97e844c4a69dc74da216 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 10 Aug 2020 17:39:06 -0600 Subject: [PATCH] workaround travis CI docker version issue The pypi docker package was recently updated to 4.3. This version uses docker api version 1.39. The docker daemon used by travis CI uses docker api version 1.38. We have to use a version of the pypi docker package less than 4.3 with travis CI currently. The .travis/runtox script is used to run `tox` in the travis CI environment. Change this script to look for the docker server api version and set LSR_MOLECULE_DOCKER_VERSION appropriately so that tox.ini will install the correct version of the pypi docker package. --- .travis/runtox | 18 ++++++++++++++++++ tox.ini | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.travis/runtox b/.travis/runtox index f0174822..7981381b 100755 --- a/.travis/runtox +++ b/.travis/runtox @@ -16,6 +16,24 @@ ME=$(basename $0) SCRIPTDIR=$(readlink -f $(dirname $0)) BANNERSIZE=90 +# LSR_MOLECULE_DOCKER_VERSION is the version string to pass +# to pip install - this is usually a comparison operator +# followed by a version number e.g. '<4.3' but in reality +# may be anything that pip allows to follow a package name +# in an install specification +if [ -z "${LSR_MOLECULE_DOCKER_VERSION:-}" ]; then + if type docker > /dev/null 2>&1; then + DOCKER_SERVER_API_VERSION=$(docker version --format '{{.Server.APIVersion}}') + case "$DOCKER_SERVER_API_VERSION" in + 1.3[0-8]|1.[0-2]*) LSR_MOLECULE_DOCKER_VERSION='<4.3';; + *) LSR_MOLECULE_DOCKER_VERSION="";; + esac + else + LSR_MOLECULE_DOCKER_VERSION="" + fi +fi +export LSR_MOLECULE_DOCKER_VERSION + . ${SCRIPTDIR}/utils.sh . ${SCRIPTDIR}/config.sh diff --git a/tox.ini b/tox.ini index 7bf65387..860ef7cf 100644 --- a/tox.ini +++ b/tox.ini @@ -109,7 +109,7 @@ commands = changedir = {toxinidir} deps = {env:LSR_ANSIBLE_DEP:ansible} - docker + docker{env:LSR_MOLECULE_DOCKER_VERSION:} molecule<3 selinux wcwidth==0.1.9;python_version=="3.6"