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

ghaf-hw-test: Wget retry loop #56

Merged
merged 1 commit into from
Sep 2, 2024
Merged
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
21 changes: 20 additions & 1 deletion ghaf-hw-test.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,26 @@ pipeline {
sh "exit 1"
}
sh "rm -fr ${TMP_IMG_DIR}"
sh "wget -nv --show-progress --progress=dot:giga -P ${TMP_IMG_DIR} ${params.IMG_URL}"
// Wget occasionally fails due to a failure in name lookup. Below is a
// hack to force re-try a few times before aborting. Wget options, such
// as --tries, --waitretry, --retry-connrefused, etc. do not help in case
// the failure is due to an issue in name resolution which is considered
// a fatal error. Therefore, we need to add the below retry loop.
// TODO: remove the below re-try loop when test network DNS works
// reliably.
sh """
retry=1
max_retry=3
while ! wget -nv --show-progress --progress=dot:giga -P ${TMP_IMG_DIR} ${params.IMG_URL};
do
if (( \$retry >= \$max_retry )); then
echo "wget failed after \$retry retries"
exit 1
fi
retry=\$(( \$retry + 1 ))
sleep 5
done
"""
img_relpath = run_cmd("find ${TMP_IMG_DIR} -type f -print -quit | grep .")
println "Downloaded image to workspace: ${img_relpath}"
// Uncompress, keeping only the decompressed image file
Expand Down
Loading