From fd8600750731191d965683d87b1cda3011743377 Mon Sep 17 00:00:00 2001 From: Nathan Moinvaziri Date: Mon, 22 Jun 2020 08:02:36 -0700 Subject: [PATCH] Added ability to specify the number of upload attempts via command line. (#276) * Added ability to specify the number of upload attempts via command line. * Update codecov/__init__.py * Update codecov/__init__.py * Update codecov/__init__.py * Update codecov/__init__.py Co-authored-by: Thomas Hu Co-authored-by: Thomas Hu --- codecov/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/codecov/__init__.py b/codecov/__init__.py index 3308d1b9..3886db7d 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -407,6 +407,12 @@ def main(*argv, **kwargs): help="Specify a custom pr number, provided automatically for supported CI companies", ) advanced.add_argument("--tag", default=None, help="Git tag") + advanced.add_argument( + "--tries", + default=3, + type=int, + help="Specify the total number of attempts to make when uploading coverage report", + ) enterprise = parser.add_argument_group( "======================== Enterprise ========================" @@ -1108,6 +1114,7 @@ def main(*argv, **kwargs): res = retry_upload( "%s/upload/v4?%s" % (codecov.url, urlargs), requests.post, + retries=codecov.tries, break_codes=(200, 400, 406), verify=codecov.cacert, headers={ @@ -1128,6 +1135,7 @@ def main(*argv, **kwargs): s3 = retry_upload( upload_url, requests.put, + retries=codecov.tries, verify=codecov.cacert, data=reports_gzip, headers={ @@ -1149,6 +1157,7 @@ def main(*argv, **kwargs): res = retry_upload( "%s/upload/v2?%s" % (codecov.url, urlargs), requests.post, + retries=codecov.tries, verify=codecov.cacert, data=reports_gzip, headers={