summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Elrod <rick@elrod.me>2020-03-20 14:01:59 -0500
committerGitHub <noreply@github.com>2020-03-20 12:01:59 -0700
commit9283f8077d9fc7e53f37ecf8ac8fed74bfc3bc8f (patch)
treee4d52fab2c8d432f228679098e45f9c531ba5920
parent3bfd8a72b43f81e0c74d15f3a8ae4abf9e236712 (diff)
downloadansible-9283f8077d9fc7e53f37ecf8ac8fed74bfc3bc8f.tar.gz
Fix coverage script to handle ongoing runs (#68380)
* Fix get_recent_coverage_runs.py to handle ongoing runs Signed-off-by: Rick Elrod <rick@elrod.me> * Color code test status to make it easier to see at a glance Signed-off-by: Rick Elrod <rick@elrod.me> * fix lint Signed-off-by: Rick Elrod <rick@elrod.me>
-rwxr-xr-xhacking/shippable/get_recent_coverage_runs.py28
1 files changed, 25 insertions, 3 deletions
diff --git a/hacking/shippable/get_recent_coverage_runs.py b/hacking/shippable/get_recent_coverage_runs.py
index 88f5b3a985..e05c1061f2 100755
--- a/hacking/shippable/get_recent_coverage_runs.py
+++ b/hacking/shippable/get_recent_coverage_runs.py
@@ -20,6 +20,7 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
+from ansible.utils.color import stringc
import requests
import sys
@@ -53,11 +54,32 @@ def get_coverage_runs():
def pretty_coverage_runs(runs):
- for run in sorted(runs, key=lambda x: x['endedAt']):
+ ended = []
+ in_progress = []
+ for run in runs:
+ if run.get('endedAt'):
+ ended.append(run)
+ else:
+ in_progress.append(run)
+
+ for run in sorted(ended, key=lambda x: x['endedAt']):
if run['statusCode'] == 30:
- print('🙂 [PASS] https://app.shippable.com/github/ansible/ansible/runs/%s (%s)' % (run['runNumber'], run['endedAt']))
+ print('🙂 [%s] https://app.shippable.com/github/ansible/ansible/runs/%s (%s)' % (
+ stringc('PASS', 'green'),
+ run['runNumber'],
+ run['endedAt']))
else:
- print('😢 [FAIL] https://app.shippable.com/github/ansible/ansible/runs/%s (%s)' % (run['runNumber'], run['endedAt']))
+ print('😢 [%s] https://app.shippable.com/github/ansible/ansible/runs/%s (%s)' % (
+ stringc('FAIL', 'red'),
+ run['runNumber'],
+ run['endedAt']))
+
+ if in_progress:
+ print('The following runs are ongoing:')
+ for run in in_progress:
+ print('🤔 [%s] https://app.shippable.com/github/ansible/ansible/runs/%s' % (
+ stringc('FATE', 'yellow'),
+ run['runNumber']))
def main():