]> source.dussan.org Git - rspamd.git/commitdiff
Ignore coveralls API errors 3002/head
authorAnton Yuzhaninov <citrin+git@citrin.ru>
Tue, 13 Aug 2019 14:47:00 +0000 (15:47 +0100)
committerAnton Yuzhaninov <citrin+git@citrin.ru>
Tue, 13 Aug 2019 14:47:00 +0000 (15:47 +0100)
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

index 8fad0f55bfb08235d1d3fd23183a8a4da6af2d6e..09380a3865fd730ba80d7905294b4a3ba61e7b21 100755 (executable)
@@ -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)