summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2024-07-02 14:52:22 -0400
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-07-02 19:03:54 +0000
commit0444ddf78e3026056ee3786119e595909c039ff2 (patch)
tree6663c1ce86b2b768f0d78e66a2818a9ff52c135e
parent9bf8236c24839045787fa284471fab950485285c (diff)
downloadgit-repo-0444ddf78e3026056ee3786119e595909c039ff2.tar.gz
project: ignore more curl failure modesv2.46
Current clone bundle fetches from Google storage results HTTP/404 and curl exiting 56. This is basically WAI, so stop emitting verbose error output whenever that happens. Also add a few more curl exit statuses based on chromite history, and document them. Change-Id: I3109f8a8a19109ba9bbd62780b40bbcd4fce9b76 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/432197 Commit-Queue: Mike Frysinger <vapier@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Mike Frysinger <vapier@google.com>
-rw-r--r--project.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/project.py b/project.py
index edf0723b..377e98c6 100644
--- a/project.py
+++ b/project.py
@@ -2806,6 +2806,8 @@ class Project:
2806 def _FetchBundle(self, srcUrl, tmpPath, dstPath, quiet, verbose): 2806 def _FetchBundle(self, srcUrl, tmpPath, dstPath, quiet, verbose):
2807 platform_utils.remove(dstPath, missing_ok=True) 2807 platform_utils.remove(dstPath, missing_ok=True)
2808 2808
2809 # We do not use curl's --retry option since it generally doesn't
2810 # actually retry anything; code 18 for example, it will not retry on.
2809 cmd = ["curl", "--fail", "--output", tmpPath, "--netrc", "--location"] 2811 cmd = ["curl", "--fail", "--output", tmpPath, "--netrc", "--location"]
2810 if quiet: 2812 if quiet:
2811 cmd += ["--silent", "--show-error"] 2813 cmd += ["--silent", "--show-error"]
@@ -2842,11 +2844,18 @@ class Project:
2842 (output, _) = proc.communicate() 2844 (output, _) = proc.communicate()
2843 curlret = proc.returncode 2845 curlret = proc.returncode
2844 2846
2845 if curlret == 22: 2847 if curlret in (22, 35, 56, 92):
2848 # We use --fail so curl exits with unique status.
2846 # From curl man page: 2849 # From curl man page:
2847 # 22: HTTP page not retrieved. The requested url was not found 2850 # 22: HTTP page not retrieved. The requested url was not found
2848 # or returned another error with the HTTP error code being 400 2851 # or returned another error with the HTTP error code being
2849 # or above. This return code only appears if -f, --fail is used. 2852 # 400 or above.
2853 # 35: SSL connect error. The SSL handshaking failed. This can
2854 # be thrown by Google storage sometimes.
2855 # 56: Failure in receiving network data. This shows up with
2856 # HTTP/404 on Google storage.
2857 # 92: Stream error in HTTP/2 framing layer. Basically the same
2858 # as 22 -- Google storage sometimes throws 500's.
2850 if verbose: 2859 if verbose:
2851 print( 2860 print(
2852 "%s: Unable to retrieve clone.bundle; ignoring." 2861 "%s: Unable to retrieve clone.bundle; ignoring."