Changeset 251368 in webkit


Ignore:
Timestamp:
Oct 21, 2019 11:34:45 AM (5 years ago)
Author:
aakash_jain@apple.com
Message:

EWS should have a way to retry a patch
https://bugs.webkit.org/show_bug.cgi?id=196599

Reviewed by Jonathan Bedard.

  • BuildSlaveSupport/ews-app/ews/models/build.py:

(Build): Add the retried field to keep track of whether a build is requested to be retried or not.
(Build.set_retried): Method to set the retried field.

  • BuildSlaveSupport/ews-app/ews/templates/statusbubble.html: Added the 'Retry failed builds' button.
  • BuildSlaveSupport/ews-app/ews/views/retrypatch.py:

(RetryPatch.post): Added a check if the build is already retried. Also, set the retried flag appropriately.

  • BuildSlaveSupport/ews-app/ews/views/statusbubble.py:

(StatusBubble._build_bubble): Updated the status-bubble to in-progress while waiting for build to be retried.
(StatusBubble._build_bubbles_for_patch): Display the retry button only if there are failed builds.

  • BuildSlaveSupport/ews-app/ews/migrations/0002_build_retried.py: Added database migration.
Location:
trunk/Tools
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/BuildSlaveSupport/ews-app/ews/models/build.py

    r243502 r251368  
    4545    started_at = models.IntegerField(null=True, blank=True)
    4646    complete_at = models.IntegerField(null=True, blank=True)
     47    retried = models.BooleanField(default=False)
    4748    created = models.DateTimeField(auto_now_add=True)
    4849    modified = models.DateTimeField(auto_now=True)
     
    9394
    9495    @classmethod
     96    def set_retried(cls, uid, retried=True):
     97        build = Build.get_existing_build(uid)
     98        if not build:
     99            return
     100        build.retried = retried
     101        build.save(update_fields=['retried', 'modified'])
     102        _log.info('Updated build {} in database with retried={}'.format(uid, retried))
     103
     104    @classmethod
    95105    def get_existing_build(cls, uid):
    96106        try:
  • trunk/Tools/BuildSlaveSupport/ews-app/ews/templates/statusbubble.html

    r244940 r251368  
    4949}
    5050form {
     51    float: left;
    5152    display: block;
    5253}
     
    101102{% endif %}
    102103
     104{% if show_retry_button %}
     105  <form name="retry" method="POST" action="/retry/">{% csrf_token %}
     106    <input type="hidden" name="patch_id" value="{{ patch_id }}">
     107    <input class="status" type="submit" value="&#8635; Retry failed builds">
     108  </form>
     109{% endif %}
     110
    103111<script>
    104112// Convert from UTC dates to local.
  • trunk/Tools/BuildSlaveSupport/ews-app/ews/views/retrypatch.py

    r250623 r251368  
    2626
    2727from django.http import HttpResponse
    28 from django.shortcuts import render
     28from django.shortcuts import redirect, render
    2929from django.views import View
    3030from django.views.decorators.clickjacking import xframe_options_exempt
    3131
    3232from ews.common.buildbot import Buildbot
     33from ews.models.build import Build
    3334from ews.models.patch import Patch
    3435from ews.views.statusbubble import StatusBubble
     
    5657        failed_to_retry_builds = []
    5758        for build in builds_to_retry:
     59            if build.retried:
     60                _log.warn('Build {} for patch {} is already retried.'.format(build.uid, patch_id))
     61                continue
     62            Build.set_retried(build.uid, True)
    5863            if not Buildbot.retry_build(build.builder_id, build.number):
    5964                failed_to_retry_builds.append(build)
     65                Build.set_retried(build.uid, False)
    6066
    6167        if len(failed_to_retry_builds) > 0:
     
    6470            _log.warn(message)
    6571            return HttpResponse(message)
    66         return HttpResponse('Submitted {} build(s) to EWS for retry for patch {}.'.format(len(builds_to_retry), patch_id))
     72        return redirect('/status-bubble/{}'.format(patch_id))
  • trunk/Tools/BuildSlaveSupport/ews-app/ews/views/statusbubble.py

    r251256 r251368  
    9999                bubble['state'] = 'started'
    100100            bubble['details_message'] = 'Build is in-progress. Recent messages:' + self._steps_messages_from_multiple_builds(builds)
     101        elif build.retried:
     102            bubble['state'] = 'started'
     103            bubble['details_message'] = 'Waiting for available bot to retry the build.\n\nRecent messages:' + self._steps_messages_from_multiple_builds(builds)
    101104        elif build.result == Buildbot.SUCCESS:
    102105            if is_parent_build:
     
    277280        show_submit_to_ews = True
    278281        failed_to_apply = False  # TODO: https://bugs.webkit.org/show_bug.cgi?id=194598
     282        show_retry = False
    279283        bubbles = []
    280284
    281285        if not (patch and patch.sent_to_buildbot):
    282             return (None, show_submit_to_ews, failed_to_apply)
     286            return (None, show_submit_to_ews, failed_to_apply, show_retry)
    283287
    284288        for queue in StatusBubble.ALL_QUEUES:
     
    290294                show_submit_to_ews = False
    291295                bubbles.append(bubble)
    292 
    293         return (bubbles, show_submit_to_ews, failed_to_apply)
     296                if bubble['state'] in ('fail', 'error'):
     297                    show_retry = True
     298
     299        return (bubbles, show_submit_to_ews, failed_to_apply, show_retry)
    294300
    295301    @xframe_options_exempt
     
    298304        patch_id = int(patch_id)
    299305        patch = Patch.get_patch(patch_id)
    300         bubbles, show_submit_to_ews, show_failure_to_apply = self._build_bubbles_for_patch(patch, hide_icons)
     306        bubbles, show_submit_to_ews, show_failure_to_apply, show_retry = self._build_bubbles_for_patch(patch, hide_icons)
    301307
    302308        template_values = {
     
    305311            'show_submit_to_ews': show_submit_to_ews,
    306312            'show_failure_to_apply': show_failure_to_apply,
     313            'show_retry_button': show_retry,
    307314        }
    308315        return render(request, 'statusbubble.html', template_values)
  • trunk/Tools/ChangeLog

    r251365 r251368  
     12019-10-18  Aakash Jain  <aakash_jain@apple.com>
     2
     3        EWS should have a way to retry a patch
     4        https://bugs.webkit.org/show_bug.cgi?id=196599
     5
     6        Reviewed by Jonathan Bedard.
     7
     8        * BuildSlaveSupport/ews-app/ews/models/build.py:
     9        (Build): Add the retried field to keep track of whether a build is requested to be retried or not.
     10        (Build.set_retried): Method to set the retried field.
     11        * BuildSlaveSupport/ews-app/ews/templates/statusbubble.html: Added the 'Retry failed builds' button.
     12        * BuildSlaveSupport/ews-app/ews/views/retrypatch.py:
     13        (RetryPatch.post): Added a check if the build is already retried. Also, set the retried flag appropriately.
     14        * BuildSlaveSupport/ews-app/ews/views/statusbubble.py:
     15        (StatusBubble._build_bubble): Updated the status-bubble to in-progress while waiting for build to be retried.
     16        (StatusBubble._build_bubbles_for_patch): Display the retry button only if there are failed builds.
     17        * BuildSlaveSupport/ews-app/ews/migrations/0002_build_retried.py: Added database migration.
     18
    1192019-10-21  Alicia Boya García  <aboya@igalia.com>
    220
Note: See TracChangeset for help on using the changeset viewer.