From 16b12ba5b95e9696fa58719d671e9fe85e400ea8 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Tue, 2 Feb 2016 14:47:59 -0800 Subject: [PATCH] Check twine uploads for success Twine occasionally hits 500 errors from pypi but that doesn't necessarily mean that the upload failed. We can check if it succeeded directly by requesting an HTTP HEAD against the resource path. Use the result of this request to determine if we have failed. Change-Id: I1f12c5c7b1bf0f556d10366336a471b81a6cc68c --- jenkins/scripts/pypi-tarball-upload.sh | 5 ++++- jenkins/scripts/pypi-wheel-upload.sh | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/jenkins/scripts/pypi-tarball-upload.sh b/jenkins/scripts/pypi-tarball-upload.sh index 411aab501d..ac482ee876 100755 --- a/jenkins/scripts/pypi-tarball-upload.sh +++ b/jenkins/scripts/pypi-tarball-upload.sh @@ -33,4 +33,7 @@ curl --fail -o $FILENAME http://$TARBALL_SITE/$PROJECT/$FILENAME # Make sure we actually got a gzipped file file -b $FILENAME | grep gzip -twine upload -r pypi $FILENAME +# Uploads may claim to fail but actually succeed so we check if we +# can download after upload to determine success. +twine upload -r pypi $FILENAME || true +curl --head --silent --fail "https://pypi.python.org/simple/$PROJECT/$FILENAME" >/dev/null 2>&1 diff --git a/jenkins/scripts/pypi-wheel-upload.sh b/jenkins/scripts/pypi-wheel-upload.sh index 9d37d72e25..bf1bbeb11a 100755 --- a/jenkins/scripts/pypi-wheel-upload.sh +++ b/jenkins/scripts/pypi-wheel-upload.sh @@ -35,4 +35,7 @@ curl --fail -o $FILENAME http://$TARBALL_SITE/$PROJECT/$FILENAME # Make sure we actually got a wheel file -b $FILENAME | grep -i zip -twine upload -r pypi $FILENAME +# Uploads may claim to fail but actually succeed so we check if we +# can download after upload to determine success. +twine upload -r pypi $FILENAME || true +curl --head --silent --fail "https://pypi.python.org/simple/$PROJECT/$FILENAME" >/dev/null 2>&1