Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic retry mechanism to sig-repo jar download #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/main/resources/detect-sh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ DETECT_JAVA_PATH=${DETECT_JAVA_PATH:-}
# heap size, you would set DETECT_JAVA_OPTS=-Xmx6G.
DETECT_JAVA_OPTS=${DETECT_JAVA_OPTS:-}

# If you want to configure different curl-based retry behavior,
# specify DETECT_CURL_RETRY_OPTS in your environment.
# Setting this variable to blank will disable retrying entirely
DETECT_CURL_RETRY_OPTS=${DETECT_CURL_RETRY_OPTS:-"--retry 3 --retry-delay 5 --retry-max-time 30"}

# If you want to pass any additional options to
# curl, specify DETECT_CURL_OPTS in your environment.
# For example, to specify a proxy, you would set
Expand Down Expand Up @@ -156,7 +161,7 @@ get_detect() {
if [ ${USE_REMOTE} -eq 1 ]; then
echo "getting ${DETECT_SOURCE} from remote"
TEMP_DETECT_DESTINATION="${DETECT_DESTINATION}-temp"
curlReturn=$(curl ${DETECT_CURL_OPTS} --silent -w "%{http_code}" -L -o "${TEMP_DETECT_DESTINATION}" --create-dirs "${DETECT_SOURCE}")
curlReturn=$(curl ${DETECT_CURL_OPTS} ${DETECT_CURL_RETRY_OPTS} --silent -w "%{http_code}" -L -o "${TEMP_DETECT_DESTINATION}" --create-dirs "${DETECT_SOURCE}")
if [[ 200 -eq ${curlReturn} ]]; then
mv "${TEMP_DETECT_DESTINATION}" "${DETECT_DESTINATION}"
if [[ -f ${LOCAL_FILE} ]]; then
Expand Down