Procházet zdrojové kódy

Retry CIPD client download on Linux / macOS

Transient network conditions can cause the CIPD client download to fail,
so add a retry to the download.

When using `wget` we additionally retry usually fatal errors like
"connection refused" via `--retry-connrefused`. `curl` also has that
parameter, but it was added more recently in version 7.52.0, which isn't
available on supported platforms like Ubuntu 16.04. Once we raise the
minimum supported version of curl, we should add that parameter as well.

In either case, we retry 3 times and wait 5 seconds between each try,
which matches the retries recently added for Windows.

Bug: 1145741
Change-Id: Ib73bb3413ba4d5251c2b027a87dabd1378ab6c44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2532896
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Commit-Queue: Matthew Kotsenas <mattkot@microsoft.com>
Matt Kotsenas před 4 roky
rodič
revize
1607bf453a
1 změnil soubory, kde provedl 2 přidání a 2 odebrání
  1. 2 2
      cipd

+ 2 - 2
cipd

@@ -155,9 +155,9 @@ function clean_bootstrap() {
     mktemp "${MYPATH}/.cipd_client.XXXXXXX")
 
   if hash curl 2> /dev/null ; then
-    curl "${URL}" -s --show-error -f -A "${USER_AGENT}" -L -o "${CIPD_CLIENT_TMP}"
+    curl "${URL}" -s --show-error -f --retry 3 --retry-delay 5 -A "${USER_AGENT}" -L -o "${CIPD_CLIENT_TMP}"
   elif hash wget 2> /dev/null ; then
-    wget "${URL}" -q -U "${USER_AGENT}" -O "${CIPD_CLIENT_TMP}"
+    wget "${URL}" -q -t 3 -w 5 --retry-connrefused -U "${USER_AGENT}" -O "${CIPD_CLIENT_TMP}"
   else
     >&2 echo -n ""
     >&2 echo -n "Your platform is missing a supported fetch command. "