Fix docker-login to conditionally use -e 18/6318/1
authorJeremy Phelps <jphelps@linuxfoundation.org>
Tue, 5 Sep 2017 18:37:57 +0000 (13:37 -0500)
committerJeremy Phelps <jphelps@linuxfoundation.org>
Tue, 5 Sep 2017 18:37:57 +0000 (13:37 -0500)
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 <jphelps@linuxfoundation.org>
shell/docker-login.sh

index 2c8a40b..210ce3b 100644 (file)
@@ -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' ]