Skip to content

Commit

Permalink
Merge pull request #75 from reactiveops/ej/docker-compatibility
Browse files Browse the repository at this point in the history
simple idea to make rok8s-scripts compatible with docker older and ne…
  • Loading branch information
ejether authored Aug 4, 2017
2 parents 14c555d + 8bf0ed2 commit 543df33
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion bin/docker-push
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,18 @@ then
exit 1
fi

docker tag -f "${DOCKERTAG}:latest" "${EXTERNAL_REGISTRY_BASE_DOMAIN}/${REPOSITORY_NAME}:${CI_REF}"
DOCKER_TAG_COM="docker tag"
version=$(docker version | grep -e Version | head -n 1 | awk '{ print $2 }')
major=$(echo "${version}" | awk -F. '{ print $1 }')
minor=$(echo "${version}" | awk -F. '{ print $2 }')

if [[ "${minor#0}" -le 9 && "${major}" -eq 1 ]] || [ "${major}" -eq 0 ]
then
DOCKER_TAG_COM="${DOCKER_TAG_COM} -f "
fi

$DOCKER_TAG_COM "${DOCKERTAG}:latest" "${EXTERNAL_REGISTRY_BASE_DOMAIN}/${REPOSITORY_NAME}:${CI_REF}"

if [ $? -ne 0 ]
then
echo "Unable to tag image, aborting"
Expand Down

0 comments on commit 543df33

Please sign in to comment.