Title: [241485] trunk/Tools
Revision
241485
Author
aakash_j...@apple.com
Date
2019-02-13 16:16:16 -0800 (Wed, 13 Feb 2019)

Log Message

[ews-app] Fetch builder id to name mapping
https://bugs.webkit.org/show_bug.cgi?id=194355

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-app/ews/common/buildbot.py:
(Buildbot.get_builder_id_to_name_mapping):
(Buildbot._get_display_name_from_builder_name):

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/ews-app/ews/common/buildbot.py (241484 => 241485)


--- trunk/Tools/BuildSlaveSupport/ews-app/ews/common/buildbot.py	2019-02-14 00:11:52 UTC (rev 241484)
+++ trunk/Tools/BuildSlaveSupport/ews-app/ews/common/buildbot.py	2019-02-14 00:16:16 UTC (rev 241485)
@@ -22,8 +22,10 @@
 
 import logging
 import os
+import re
 import subprocess
 
+import ews.common.util as util
 import ews.config as config
 
 _log = logging.getLogger(__name__)
@@ -49,3 +51,26 @@
             _log.warn('Error executing: {}, return code={}'.format(command, return_code))
 
         return return_code
+
+    @classmethod
+    def get_builder_id_to_name_mapping(cls):
+        builder_id_to_name_mapping = {}
+        builder_url = 'http://{}/api/v2/builders'.format(config.BUILDBOT_SERVER_HOST)
+        builders_data = util.fetch_data_from_url(builder_url)
+        if not builders_data:
+            return {}
+        for builder in builders_data.json().get('builders', []):
+            builder_id = builder['builderid']
+            builder_name = builder.get('name')
+            display_name = builder.get('description')
+            if not display_name:
+                display_name = Buildbot._get_display_name_from_builder_name(builder_name)
+            builder_id_to_name_mapping[builder_id] = {'builder_name': builder_name, 'display_name': display_name}
+        return builder_id_to_name_mapping
+
+    @classmethod
+    def _get_display_name_from_builder_name(cls, builder_name):
+        words = re.split('[, \-_:()]+', builder_name)
+        if not words:
+            return builder_name
+        return words[0].lower()

Modified: trunk/Tools/ChangeLog (241484 => 241485)


--- trunk/Tools/ChangeLog	2019-02-14 00:11:52 UTC (rev 241484)
+++ trunk/Tools/ChangeLog	2019-02-14 00:16:16 UTC (rev 241485)
@@ -1,3 +1,14 @@
+2019-02-13  Aakash Jain  <aakash_j...@apple.com>
+
+        [ews-app] Fetch builder id to name mapping
+        https://bugs.webkit.org/show_bug.cgi?id=194355
+
+        Reviewed by Lucas Forschler.
+
+        * BuildSlaveSupport/ews-app/ews/common/buildbot.py:
+        (Buildbot.get_builder_id_to_name_mapping):
+        (Buildbot._get_display_name_from_builder_name):
+
 2019-02-12  Jiewen Tan  <jiewen_...@apple.com>
 
         Further restricting webarchive loads
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to