Change order of validations in travis script

This commit is contained in:
Manuel de Brito Fontes 2017-10-26 19:46:57 -03:00
parent 73f5b9ba2f
commit 7c267c3fea

View file

@ -34,19 +34,6 @@ then
exit 0;
fi
# variables QUAY_USERNAME and QUAY_PASSWORD are required to push docker images
if [ "$QUAY_USERNAME" == "" ];
then
echo "Environment variable QUAY_USERNAME is missing.";
exit 0;
fi
if [ "$QUAY_PASSWORD" == "" ];
then
echo "Environment variable QUAY_PASSWORD is missing.";
exit 0;
fi
SKIP_MESSAGE="Publication of docker image to quay.io registry skipped."
if [ "$TRAVIS_EVENT_TYPE" != "api" ];
@ -67,6 +54,19 @@ then
exit 0;
fi
# variables QUAY_USERNAME and QUAY_PASSWORD are required to push docker images
if [ "$QUAY_USERNAME" == "" ];
then
echo "Environment variable QUAY_USERNAME is missing.";
exit 0;
fi
if [ "$QUAY_PASSWORD" == "" ];
then
echo "Environment variable QUAY_PASSWORD is missing.";
exit 0;
fi
function docker_tag_exists() {
TAG=${2//\"/}
IMAGES=$(curl -s -H "Authorization: Bearer ${QUAY_PASSWORD}" https://quay.io/api/v1/repository/$1/image/ | jq '.images | sort_by(.sort_index) | .[] .tags | select(.[] !=null) | .[0]' | sed s/\"//g)