From ec094cdfda59dedd29ebe4064b2f0de9f5c4eead Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 3 Apr 2019 16:35:49 -0700 Subject: [PATCH] Increase timeout for promote script Increase the timeout used when checking if artifacts have landed in Bintray from 20m to 40m. Also added some additional protection against the curl command failing. Closes gh-16443 --- ci/scripts/promote.sh | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/ci/scripts/promote.sh b/ci/scripts/promote.sh index 941507d0e8..931c0e293e 100755 --- a/ci/scripts/promote.sh +++ b/ci/scripts/promote.sh @@ -45,20 +45,25 @@ if [[ $RELEASE_TYPE = "RELEASE" ]]; then POST "${ARTIFACTORY_SERVER}/api/build/distribute/${buildName}/${buildNumber}" > /dev/null || { echo "Failed to distribute" >&2; exit 1; } echo "Waiting for artifacts to be published" - ARTIFACTS_PUBLISHED=false - WAIT_TIME=10 - COUNTER=0 - while [ $ARTIFACTS_PUBLISHED == "false" ] && [ $COUNTER -lt 120 ]; do - result=$( curl -s https://api.bintray.com/packages/"${BINTRAY_SUBJECT}"/"${BINTRAY_REPO}"/"${groupId}" ) - versions=$( echo "$result" | jq -r '.versions' ) - exists=$( echo "$versions" | grep "$version" -o || true ) - if [ "$exists" = "$version" ]; then - ARTIFACTS_PUBLISHED=true + + WAIT_TIME=20 + WAIT_ATTEMPTS=120 + + artifacts_published=false + retry_counter=0 + while [ $artifacts_published == "false" ] && [ $retry_counter -lt WAIT_ATTEMPTS ]; do + result=$( curl -s -f -u ${BINTRAY_USERNAME}:${BINTRAY_API_KEY} https://api.bintray.com/packages/"${BINTRAY_SUBJECT}"/"${BINTRAY_REPO}"/"${groupId}" ) + if [ $? -eq 0 ]; then + versions=$( echo "$result" | jq -r '.versions' ) + exists=$( echo "$versions" | grep "$version" -o || true ) + if [ "$exists" = "$version" ]; then + artifacts_published=true + fi fi - COUNTER=$(( COUNTER + 1 )) + retry_counter=$(( retry_counter + 1 )) sleep $WAIT_TIME done - if [[ $ARTIFACTS_PUBLISHED = "false" ]]; then + if [[ $artifacts_published = "false" ]]; then echo "Failed to publish" exit 1 else