[ews-app] Use Buildbot result code variables
authoraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Mar 2019 17:03:42 +0000 (17:03 +0000)
committeraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Mar 2019 17:03:42 +0000 (17:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195668

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/ews-app/ews/common/buildbot.py:
(Buildbot): Added Buildbot result code variables.
* BuildSlaveSupport/ews-app/ews/views/statusbubble.py:
(StatusBubble._build_bubble): Used Buildbot result code variables.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242884 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/BuildSlaveSupport/ews-app/ews/common/buildbot.py
Tools/BuildSlaveSupport/ews-app/ews/views/statusbubble.py
Tools/ChangeLog

index 9d9ffd4..1bd521e 100644 (file)
@@ -20,6 +20,8 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+from future.utils import lrange
+
 import logging
 import os
 import re
@@ -32,6 +34,10 @@ _log = logging.getLogger(__name__)
 
 
 class Buildbot():
+    # Buildbot status codes referenced from https://github.com/buildbot/buildbot/blob/master/master/buildbot/process/results.py
+    ALL_RESULTS = lrange(7)
+    SUCCESS, WARNINGS, FAILURE, SKIPPED, EXCEPTION, RETRY, CANCELLED = ALL_RESULTS
+
     @classmethod
     def send_patch_to_buildbot(cls, patch_path, properties=[]):
         command = ['buildbot', 'try',
index 93df06e..94e0c54 100644 (file)
@@ -28,6 +28,7 @@ from django.http import HttpResponse
 from django.shortcuts import render
 from django.views import View
 from django.views.decorators.clickjacking import xframe_options_exempt
+from ews.common.buildbot import Buildbot
 from ews.models.patch import Patch
 import ews.config as config
 
@@ -57,17 +58,17 @@ class StatusBubble(View):
         bubble["details_message"] = '{}\n{}'.format(builder_full_name, build.state_string)
         if build.result is None:
             bubble["state"] = "started"
-        elif build.result == 0:  # SUCCESS
+        elif build.result == Buildbot.SUCCESS:
             bubble["state"] = "pass"
-        elif build.result == 1:  # WARNINGS
+        elif build.result == Buildbot.WARNINGS:
             bubble["state"] = "pass"
-        elif build.result == 2:  # FAILURE
+        elif build.result == Buildbot.FAILURE:
             bubble["state"] = "fail"
-        elif build.result == 3:  # SKIPPED
+        elif build.result == Buildbot.SKIPPED:
             bubble["state"] = "none"
-        elif build.result == 4:  # EXCEPTION
+        elif build.result == Buildbot.EXCEPTION:
             bubble["state"] = "error"
-        elif build.result == 5:  # RETRY
+        elif build.result == Buildbot.RETRY:
             bubble["state"] = "provisional-fail"
         else:
             bubble["state"] = "fail"
@@ -85,7 +86,7 @@ class StatusBubble(View):
         return [build for build in patch.build_set.all() if build.builder_display_name == queue]
 
     def _should_show_bubble_for_build(self, build):
-        if build and build.result == 3 and re.search(r'Patch .* doesn\'t have relevant changes', build.state_string):
+        if build and build.result == Buildbot.SKIPPED and re.search(r'Patch .* doesn\'t have relevant changes', build.state_string):
             return False
         return True
 
index dcd457b..4027743 100644 (file)
@@ -1,3 +1,15 @@
+2019-03-13  Aakash Jain  <aakash_jain@apple.com>
+
+        [ews-app] Use Buildbot result code variables
+        https://bugs.webkit.org/show_bug.cgi?id=195668
+
+        Reviewed by Alexey Proskuryakov.
+
+        * BuildSlaveSupport/ews-app/ews/common/buildbot.py:
+        (Buildbot): Added Buildbot result code variables.
+        * BuildSlaveSupport/ews-app/ews/views/statusbubble.py:
+        (StatusBubble._build_bubble): Used Buildbot result code variables.
+
 2019-03-13  Thibault Saunier  <tsaunier@igalia.com>
 
         [Flatpak] Expand submodule recursively