From: Jeremy Phelps Date: Tue, 5 Sep 2017 18:37:57 +0000 (-0500) Subject: Fix docker-login to conditionally use -e X-Git-Tag: v0.8.1^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=3297f525cb682be0b06624e11482c258fabe5341;p=releng%2Fglobal-jjb.git Fix docker-login to conditionally use -e The -e/--email flag was removed in docker version 17.06.0. Do not use if equal or less than that version. Change-Id: I69335d8ff068fbb180de284317d02f21b8b7e552 JIRA: RELENG-452 Signed-off-by: Jeremy Phelps --- diff --git a/shell/docker-login.sh b/shell/docker-login.sh index 2c8a40bb..210ce3bb 100644 --- a/shell/docker-login.sh +++ b/shell/docker-login.sh @@ -56,7 +56,18 @@ do_login() { return 1 fi - docker login -u "$USER" -p "$PASS" -e "$2" "$1" + docker_version=$(docker -v | awk '{print $3}') + compare_value=$(echo "17.06.0 $docker_version" | \ + tr " " "\n" | \ + sort -V | \ + sed -n 1p) + if [[ "$docker_version" == "$compare_value" && \ + "$docker_version" != "17.06.0" ]] + then + docker login -u "$USER" -p "$PASS" -e "$2" "$1" + else + docker login -u "$USER" -p "$PASS" + fi } if [ "${DOCKER_REGISTRY:-none}" != 'none' ]