Merge pull request #589 from carlossg/curl-error

Exit publish on unexpected error
This commit is contained in:
Carlos Sanchez 2017-12-17 11:36:19 +01:00 committed by GitHub
commit e3d4632d6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -41,13 +41,14 @@ is-published() {
opts="-v"
fi
local http_code;
http_code=$(curl $opts -q -fsSL -o /dev/null -w "%{http_code}" -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -H "Authorization: Bearer $TOKEN" "https://index.docker.io/v2/jenkins/jenkins/manifests/$tag")
http_code=$(curl $opts -q -fsL -o /dev/null -w "%{http_code}" -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -H "Authorization: Bearer $TOKEN" "https://index.docker.io/v2/jenkins/jenkins/manifests/$tag")
if [ "$http_code" -eq "404" ]; then
false
elif [ "$http_code" -eq "200" ]; then
true
else
echo "Received unexpected http code from Docker hub: $http_code"
exit 1
fi
}