From 3297f525cb682be0b06624e11482c258fabe5341 Mon Sep 17 00:00:00 2001 From: Jeremy Phelps Date: Tue, 5 Sep 2017 13:37:57 -0500 Subject: [PATCH] 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 --- shell/docker-login.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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' ] -- 2.16.6