Skip to content

Commit

Permalink
fix: curl flags
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken committed Mar 14, 2023
1 parent acfa108 commit 81fe2ef
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .evergreen/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ NODE_LTS_NAME=${NODE_LTS_NAME:-erbium}
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY:-$(pwd)}/node-artifacts"
if [[ "$OS" = "Windows_NT" ]]; then NODE_ARTIFACTS_PATH=$(cygpath --unix "$NODE_ARTIFACTS_PATH"); fi

CURL_FLAGS=(
--fail # Exit code 1 if request fails
--compressed # Request a compressed response should keep fetching fast
--location # Follow a redirect
--retry 8 # Retry HTTP 408, 429, 500, 502, 503 or 504, 8 times
--silent # Do not print a progress bar
--show-error # Despite the silent flag still print out errors
--max-time 900 # 900 seconds is 15 minutes, evergreen times out at 20
--continue-at - # If a download is interrupted it can figure out where to resume
)

mkdir -p "$NODE_ARTIFACTS_PATH/npm_global"

# Comparisons are all case insensitive
Expand All @@ -13,7 +24,7 @@ shopt -s nocasematch
# index.tab is a sorted tab separated values file with the following headers
# 0 1 2 3 4 5 6 7 8 9 10
# version date files npm v8 uv zlib openssl modules lts security
curl --retry 8 -sS "https://nodejs.org/dist/index.tab" --max-time 300 --output node_index.tab
curl "${CURL_FLAGS[@]}" "https://nodejs.org/dist/index.tab" --output node_index.tab

while IFS=$'\t' read -r -a row; do
node_index_version="${row[0]}"
Expand Down Expand Up @@ -63,7 +74,7 @@ echo "Node.js ${node_index_version} for ${operating_system}-${architecture} rele

set -o xtrace

curl --fail --retry 8 -sS "${node_download_url}" --max-time 300 --output "$node_archive_path"
curl "${CURL_FLAGS[@]}" "${node_download_url}" --output "$node_archive_path"

if [[ "$file_extension" = "zip" ]]; then
unzip -q "$node_archive_path" -d "${NODE_ARTIFACTS_PATH}"
Expand Down

0 comments on commit 81fe2ef

Please sign in to comment.