diff --git a/check.sh b/check.sh index 363d0a5..4bce6ac 100644 --- a/check.sh +++ b/check.sh @@ -28,18 +28,23 @@ fi echo "${BASE}" | grep -q "/" || BASE="library/${BASE}" echo "${TARGET}" | grep -q "/" || TARGET="library/${TARGET}" +# if no tag is give default to latest +echo "${BASE}" | grep -q ":" || BASE="${BASE}:latest" +echo "${TARGET}" | grep -q ":" || TARGET="${TARGET}:latest" -# move tha tag to its own var and remove it from the repo name + +# move the tag to its own var and remove it from the repo name BASE_TAG=$(echo "${BASE}" | sed 's/[^:]*://') TARGET_TAG=$(echo "${TARGET}" | sed 's/[^:]*://') BASE_REPO=$(echo "${BASE}" | sed 's/:.*//') TARGET_REPO=$(echo "${TARGET}" | sed 's/:.*//') + +# build the url to the repo BASE_URL="https://hub.docker.com/v2/repositories/${BASE_REPO}/tags/${BASE_TAG}" TARGET_URL="https://hub.docker.com/v2/repositories/${TARGET_REPO}/tags/${TARGET_TAG}" - # login if credentias are passed HEADER="" if [ -n "${DOCKER_USERNAME}" ] && [ -n "${DOCKER_PASSWORD}" ]; then