commit 46727d2: Ignore coveralls API errors

Anton Yuzhaninov citrin+git at citrin.ru
Tue Aug 13 14:56:03 UTC 2019


Author: Anton Yuzhaninov
Date: 2019-08-13 15:47:00 +0100
URL: https://github.com/rspamd/rspamd/commit/46727d273491d5ce2b7e74cd1b1f4501607db28f (refs/pull/3002/head)

Ignore coveralls API errors
Exiting with zero exit code in case of errors in bad style, but we do
not want to fail CI test run if coveralls.io is down. For other error
(e. g. internal scrip errors) exit code still be non zero.

---
 test/tools/merge_coveralls.py | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/test/tools/merge_coveralls.py b/test/tools/merge_coveralls.py
index 8fad0f55b..09380a386 100755
--- a/test/tools/merge_coveralls.py
+++ b/test/tools/merge_coveralls.py
@@ -160,12 +160,17 @@ if __name__ == '__main__':
 
     if args.token:
         j1['repo_token'] = args.token
-        print("sending data to coveralls...")
-        r = requests.post('https://coveralls.io/api/v1/jobs', files={"json_file": json.dumps(j1)})
-        response = r.json()
-        print("[coveralls] %s" % response['message'])
-        if 'url' in response:
-            print("[coveralls] Uploaded to %s" % response['url'])
-
-    # post https://coveralls.io/api/v1/jobs
-    # print args
+        try:
+            r = requests.post('https://coveralls.io/api/v1/jobs', files={"json_file": json.dumps(j1)})
+            r.raise_for_status()
+        except requests.exceptions.RequestException as e:
+            print("Failed to send data to coveralls: %s" % e)
+            sys.exit()
+
+        try:
+            response = r.json()
+            print("[coveralls] %s" % response['message'])
+            if 'url' in response:
+                print("[coveralls] Uploaded to %s" % response['url'])
+        except json.decoder.JSONDecodeError:
+            print("Bad resonse: '%s'" % r.text)


More information about the Commits mailing list