Commit 1e1b18af authored by Hunter Loftis's avatar Hunter Loftis

Merge pull request #285 from heroku/retry-curl

Retry curl
parents 67291e8c 7f2947e3
...@@ -13,12 +13,12 @@ install_nodejs() { ...@@ -13,12 +13,12 @@ install_nodejs() {
if needs_resolution "$version"; then if needs_resolution "$version"; then
echo "Resolving node version ${version:-(latest stable)} via semver.io..." echo "Resolving node version ${version:-(latest stable)} via semver.io..."
local version=$(curl --silent --get --data-urlencode "range=${version}" https://semver.herokuapp.com/node/resolve) local version=$(curl --silent --get --retry 5 --retry-max-time 15 --data-urlencode "range=${version}" https://semver.herokuapp.com/node/resolve)
fi fi
echo "Downloading and installing node $version..." echo "Downloading and installing node $version..."
local download_url="http://s3pository.heroku.com/node/v$version/node-v$version-$os-$cpu.tar.gz" local download_url="http://s3pository.heroku.com/node/v$version/node-v$version-$os-$cpu.tar.gz"
curl "$download_url" --silent --fail -o /tmp/node.tar.gz || (echo "Unable to download node $version; does it exist?" && false) curl "$download_url" --silent --fail --retry 5 --retry-max-time 15 -o /tmp/node.tar.gz || (echo "Unable to download node $version; does it exist?" && false)
tar xzf /tmp/node.tar.gz -C /tmp tar xzf /tmp/node.tar.gz -C /tmp
rm -rf $dir/* rm -rf $dir/*
mv /tmp/node-v$version-$os-$cpu/* $dir mv /tmp/node-v$version-$os-$cpu/* $dir
...@@ -31,12 +31,12 @@ install_iojs() { ...@@ -31,12 +31,12 @@ install_iojs() {
if needs_resolution "$version"; then if needs_resolution "$version"; then
echo "Resolving iojs version ${version:-(latest stable)} via semver.io..." echo "Resolving iojs version ${version:-(latest stable)} via semver.io..."
version=$(curl --silent --get --data-urlencode "range=${version}" https://semver.herokuapp.com/iojs/resolve) version=$(curl --silent --get --retry 5 --retry-max-time 15 --data-urlencode "range=${version}" https://semver.herokuapp.com/iojs/resolve)
fi fi
echo "Downloading and installing iojs $version..." echo "Downloading and installing iojs $version..."
local download_url="https://iojs.org/dist/v$version/iojs-v$version-$os-$cpu.tar.gz" local download_url="https://iojs.org/dist/v$version/iojs-v$version-$os-$cpu.tar.gz"
curl "$download_url" --silent --fail -o /tmp/node.tar.gz || (echo "Unable to download iojs $version; does it exist?" && false) curl "$download_url" --silent --fail --retry 5 --retry-max-time 15 -o /tmp/node.tar.gz || (echo "Unable to download iojs $version; does it exist?" && false)
tar xzf /tmp/node.tar.gz -C /tmp tar xzf /tmp/node.tar.gz -C /tmp
mv /tmp/iojs-v$version-$os-$cpu/* $dir mv /tmp/iojs-v$version-$os-$cpu/* $dir
chmod +x $dir/bin/* chmod +x $dir/bin/*
...@@ -50,7 +50,7 @@ install_npm() { ...@@ -50,7 +50,7 @@ install_npm() {
else else
if needs_resolution "$version"; then if needs_resolution "$version"; then
echo "Resolving npm version ${version} via semver.io..." echo "Resolving npm version ${version} via semver.io..."
version=$(curl --silent --get --data-urlencode "range=${version}" https://semver.herokuapp.com/npm/resolve) version=$(curl --silent --get --retry 5 --retry-max-time 15 --data-urlencode "range=${version}" https://semver.herokuapp.com/npm/resolve)
fi fi
if [[ `npm --version` == "$version" ]]; then if [[ `npm --version` == "$version" ]]; then
echo "npm `npm --version` already installed with node" echo "npm `npm --version` already installed with node"
......
...@@ -63,7 +63,7 @@ warn_missing_package_json() { ...@@ -63,7 +63,7 @@ warn_missing_package_json() {
warn_old_npm() { warn_old_npm() {
local npm_version="$(npm --version)" local npm_version="$(npm --version)"
if [ "${npm_version:0:1}" -lt "2" ]; then if [ "${npm_version:0:1}" -lt "2" ]; then
local latest_npm="$(curl --silent --get https://semver.herokuapp.com/npm/stable)" local latest_npm="$(curl --silent --get --retry 5 --retry-max-time 15 https://semver.herokuapp.com/npm/stable)"
warning "This version of npm ($npm_version) has several known issues - consider upgrading to the latest release ($latest_npm)" "https://devcenter.heroku.com/articles/nodejs-support#specifying-an-npm-version" warning "This version of npm ($npm_version) has several known issues - consider upgrading to the latest release ($latest_npm)" "https://devcenter.heroku.com/articles/nodejs-support#specifying-an-npm-version"
fi fi
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment