Skip to content
This repository has been archived by the owner on Jul 27, 2018. It is now read-only.

Commit

Permalink
Fix paging for tags
Browse files Browse the repository at this point in the history
  • Loading branch information
SISheogorath committed Nov 4, 2017
1 parent 532c547 commit 9109a79
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/version.sh
Expand Up @@ -14,7 +14,7 @@ command_exits() { command -v $1 >/dev/null 2>&1 || { echo >&2 "I require $1 but

# Docker latest version tag
# See: https://www.shivering-isles.com/helpful-shell-snippets-for-docker-testing-and-bootstrapping/
docker_image_latest_tag() { REPO=$1; [ $(echo $REPO | grep '/' | wc -l) -eq 0 ] && REPO=library/$1; wget -q -O- https://registry.hub.docker.com/v2/repositories/${REPO}/tags | jq .results[].name | sort -V | sed -e 's/"//g' | grep -P '^[[:digit:]]+((.[[:digit:]]+)?.[[:digit:]]+)' | tail -1; }
docker_image_latest_tag() { REPO=$1; [ $(echo $REPO | grep '/' | wc -l) -eq 0 ] && REPO=library/$1; wget -q -O- https://registry.hub.docker.com/v2/repositories/${REPO}/tags\?page\=1\&page_size\=250 | jq .results[].name | sed -e 's/"//g' | sort -V | grep -v "rc" | grep -P '^[[:digit:]]+((.[[:digit:]]+)?.[[:digit:]]+)$' | tail -1; }

# Version comparison greater or equal
# See: https://www.shivering-isles.com/helpful-shell-snippets-for-docker-testing-and-bootstrapping/
Expand All @@ -32,4 +32,6 @@ command_exits wget

[ -e "$DOCKERFILE" ] || { echo >&2 "File '$DOCKERFILE' doesn't exist. Aborting."; exit 1; }

echo $(docker_image_latest_tag `docker_base_name "$DOCKERFILE"` | cut -d. -f1-2)

version_ge $(docker_base_version "$DOCKERFILE") $(docker_image_latest_tag `docker_base_name "$DOCKERFILE"` | cut -d. -f1-2) && echo "Base image is up to date! Test successful." || { echo >&2 "A newer base image is available! Please update."; exit 1; }

0 comments on commit 9109a79

Please sign in to comment.