diff --git a/.evergreen/download-mongodb.sh b/.evergreen/download-mongodb.sh index 960e3013..b73f3c68 100755 --- a/.evergreen/download-mongodb.sh +++ b/.evergreen/download-mongodb.sh @@ -688,6 +688,14 @@ set_url_win32 () MONGODB_24="https://fastdl.mongodb.org/win32/mongodb-win32-i386${DEBUG}-${VERSION_24}.zip" } +# curl_retry emulates running curl with `--retry 5` and `--retry-all-errors`. +curl_retry () +{ + for i in 1 2 4 8 16; do + { curl --fail -sS --max-time 300 "$@" && return 0; } || sleep $i + done + return 1 +} # download_and_extract_package downloads a MongoDB server package. download_and_extract_package () @@ -695,10 +703,6 @@ download_and_extract_package () MONGODB_DOWNLOAD_URL=$1 EXTRACT=$2 - # shellcheck disable=SC3028 - SCRIPT_DIR=$(dirname ${BASH_SOURCE:-$0}) - . $SCRIPT_DIR/handle-paths.sh - if [ -n "${MONGODB_BINARIES:-}" ]; then cd "$(dirname "$(dirname "${MONGODB_BINARIES:?}")")" else @@ -706,7 +710,7 @@ download_and_extract_package () fi echo "Installing server binaries..." - "$SCRIPT_DIR/retry-with-backoff.sh" curl $MONGODB_DOWNLOAD_URL --output mongodb-binaries.tgz + curl_retry $MONGODB_DOWNLOAD_URL --output mongodb-binaries.tgz $EXTRACT mongodb-binaries.tgz echo "Installing server binaries... done." @@ -727,10 +731,6 @@ download_and_extract_mongosh () MONGOSH_DOWNLOAD_URL=$1 EXTRACT_MONGOSH=${2:-"tar zxf"} - # shellcheck disable=SC3028 - SCRIPT_DIR=$(dirname ${BASH_SOURCE:-$0}) - . $SCRIPT_DIR/handle-paths.sh - if [ -z "$MONGOSH_DOWNLOAD_URL" ]; then get_mongodb_download_url_for "$(get_distro)" latest false fi @@ -742,7 +742,7 @@ download_and_extract_mongosh () fi echo "Installing MongoDB shell..." - "$SCRIPT_DIR/retry-with-backoff.sh" curl $MONGOSH_DOWNLOAD_URL --output mongosh.tgz + curl_retry $MONGOSH_DOWNLOAD_URL --output mongosh.tgz $EXTRACT_MONGOSH mongosh.tgz rm -f mongosh.tgz @@ -771,10 +771,6 @@ download_and_extract () download_and_extract_mongosh "$MONGOSH_DOWNLOAD_URL" "$EXTRACT_MONGOSH" fi - # shellcheck disable=SC3028 - SCRIPT_DIR=$(dirname ${BASH_SOURCE:-$0}) - . $SCRIPT_DIR/handle-paths.sh - if [ ! -z "${INSTALL_LEGACY_SHELL:-}" ] && [ ! -e $DRIVERS_TOOLS/mongodb/bin/mongo ] && [ ! -e $DRIVERS_TOOLS/mongodb/bin/mongo.exe ]; then # The legacy mongo shell is not included in server downloads of 6.0.0-rc6 or later. Refer: SERVER-64352. # Some test scripts use the mongo shell for setup. @@ -829,10 +825,7 @@ download_and_extract_crypt_shared () mkdir crypt_shared_download cd crypt_shared_download - # shellcheck disable=SC3028 - SCRIPT_DIR=$(dirname ${BASH_SOURCE:-$0}) - . $SCRIPT_DIR/handle-paths.sh - "$SCRIPT_DIR/retry-with-backoff.sh" curl $MONGO_CRYPT_SHARED_DOWNLOAD_URL --output crypt_shared-binaries.tgz + curl_retry $MONGO_CRYPT_SHARED_DOWNLOAD_URL --output crypt_shared-binaries.tgz $EXTRACT crypt_shared-binaries.tgz LIBRARY_NAME="mongo_crypt_v1"