Skip to content

Commit

Permalink
Merge pull request #868 from dduportal/chore/temurin-retry-downloads
Browse files Browse the repository at this point in the history
chore(temurin Adoptium install scripts) provide visibility for `curl` and retry downloads
  • Loading branch information
dduportal committed Sep 2, 2024
2 parents 6f1e448 + 713680f commit e21c0e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions adoptium-get-jdk-link.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ for ARCH in ${ARCHS}; do
# Fetch the download URL from the Adoptium API
URL="https://api.adoptium.net/v3/binary/version/jdk-${ENCODED_ARCHIVE_DIRECTORY}/${OS_TYPE}/${ARCH}/jdk/hotspot/normal/eclipse?project=jdk"

if ! RESPONSE=$(curl -fsI "${URL}"); then
if ! RESPONSE=$(curl --fail --silent --show-error --retry 5 --retry-connrefused --head "${URL}"); then
echo "Error: Failed to fetch the URL for architecture ${ARCH}. Exiting with status 1." >&2
echo "Response: ${RESPONSE}" >&2
exit 1
Expand All @@ -91,7 +91,7 @@ for ARCH in ${ARCHS}; do

# Use curl to check if the URL is reachable
# If the URL is not reachable, print an error message and exit the script with status 1
if ! curl -v -fs "${REDIRECTED_URL}" >/dev/null 2>&1; then
if ! curl --fail --silent --show-error --retry 5 --retry-connrefused "${REDIRECTED_URL}" >/dev/null 2>&1; then
echo "${REDIRECTED_URL}" is not reachable for architecture "${ARCH}". >&2
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion adoptium-install-jdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if ! DOWNLOAD_URL=$("${SCRIPT_DIR}"/adoptium-get-jdk-link.sh "${JAVA_VERSION}" "
fi

# Use curl to download the JDK archive from the URL
if ! curl --silent --location --output /tmp/jdk.tar.gz "${DOWNLOAD_URL}"; then
if ! curl --silent --show-error --location --retry 5 --retry-connrefused --output /tmp/jdk.tar.gz "${DOWNLOAD_URL}"; then
echo "Error: Failed to download the JDK archive. Exiting with status 1." >&2
exit 1
fi
Expand Down

0 comments on commit e21c0e4

Please sign in to comment.