Skip to content

Commit

Permalink
Adjusted bootstrap
Browse files Browse the repository at this point in the history
Added retries to bootstrap to handle network issues from jenkins.
  • Loading branch information
altmannmarcelo committed Sep 7, 2023
1 parent 1ca39f1 commit 449f565
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions storage/innobase/xtrabackup/test/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,23 @@ parse_arguments() {
done
}

check_url() {
url=$1
tarball=$2
retries=10
# upstream sometimes reports file does not exists due to transient error
# we should retry a few times before failing back
tries=0
while [[ ${tries} -lt ${retries} ]]; do
if ! wget --spider "${url}/${tarball}" 2>/dev/null; then
tries=$((tries+1))
else
return 0;
fi
done
return 1;
}

main () {
if [ -f /etc/redhat-release ]; then
OS="rpm"
Expand All @@ -87,10 +104,10 @@ main () {
url="https://dev.mysql.com/get/Downloads/MySQL-8.1"
fallback_url="https://downloads.mysql.com/archives/get/p/23/file"
tarball="mysql-${VERSION}-linux-glibc2.17-${arch}.tar.xz"
if ! wget --spider "${url}/${tarball}" 2>/dev/null; then
if ! check_url "${url}" "${tarball}"; then
unset url
url=${fallback_url}
fi
fi
;;
xtradb80)
url="https://www.percona.com/downloads/Percona-Server-8.0/Percona-Server-${VERSION}/binary/tarball"
Expand All @@ -115,7 +132,7 @@ main () {
esac

# Check if tarball exist before any download
if ! wget --spider "${url}/${tarball}" 2>/dev/null; then
if ! check_url "${url}" "${tarball}"; then
echo "Version you specified(${VERSION}) does not exist on ${url}/${tarball}"
exit 1
else
Expand Down

0 comments on commit 449f565

Please sign in to comment.