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
pull/16472/head
Phillip Webb 6 years ago
parent f12ab1ff90
commit ec094cdfda

@ -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; } POST "${ARTIFACTORY_SERVER}/api/build/distribute/${buildName}/${buildNumber}" > /dev/null || { echo "Failed to distribute" >&2; exit 1; }
echo "Waiting for artifacts to be published" echo "Waiting for artifacts to be published"
ARTIFACTS_PUBLISHED=false
WAIT_TIME=10 WAIT_TIME=20
COUNTER=0 WAIT_ATTEMPTS=120
while [ $ARTIFACTS_PUBLISHED == "false" ] && [ $COUNTER -lt 120 ]; do
result=$( curl -s https://api.bintray.com/packages/"${BINTRAY_SUBJECT}"/"${BINTRAY_REPO}"/"${groupId}" ) artifacts_published=false
versions=$( echo "$result" | jq -r '.versions' ) retry_counter=0
exists=$( echo "$versions" | grep "$version" -o || true ) while [ $artifacts_published == "false" ] && [ $retry_counter -lt WAIT_ATTEMPTS ]; do
if [ "$exists" = "$version" ]; then result=$( curl -s -f -u ${BINTRAY_USERNAME}:${BINTRAY_API_KEY} https://api.bintray.com/packages/"${BINTRAY_SUBJECT}"/"${BINTRAY_REPO}"/"${groupId}" )
ARTIFACTS_PUBLISHED=true 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 fi
COUNTER=$(( COUNTER + 1 )) retry_counter=$(( retry_counter + 1 ))
sleep $WAIT_TIME sleep $WAIT_TIME
done done
if [[ $ARTIFACTS_PUBLISHED = "false" ]]; then if [[ $artifacts_published = "false" ]]; then
echo "Failed to publish" echo "Failed to publish"
exit 1 exit 1
else else

Loading…
Cancel
Save