Пример #1
0
    def post(self, request):
        try:
            patch_id = request.POST.get('patch_id')
            patch_id = int(patch_id)
        except (ValueError, TypeError) as e:
            return HttpResponse('Invalid patch id: {}'.format(
                request.POST.get('patch_id')))

        builds_to_retry = StatusBubble().find_failed_builds_for_patch(patch_id)
        _log.info('Retrying patch: {}. Failed builds: {}'.format(
            patch_id, builds_to_retry))
        if not builds_to_retry:
            return HttpResponse(
                'No recent failed build(s) found for patch {}.'.format(
                    patch_id))

        failed_to_retry_builds = []
        for build in builds_to_retry:
            if build.retried:
                _log.warn('Build {} for patch {} is already retried.'.format(
                    build.uid, patch_id))
                continue
            Build.set_retried(build.uid, True)
            if not Buildbot.retry_build(build.builder_id, build.number):
                failed_to_retry_builds.append(build)
                Build.set_retried(build.uid, False)

        if len(failed_to_retry_builds) > 0:
            message = 'Failed to retry {} build(s) for patch {}.'.format(
                len(failed_to_retry_builds), patch_id)
            message += ' Please contact [email protected] if the problem persist.'
            _log.warn(message)
            return HttpResponse(message)
        return redirect('/status-bubble/{}'.format(patch_id))
Пример #2
0
    def patches_to_send_to_commit_queue(self, patch_ids):
        if not patch_ids:
            return patch_ids
        patches_in_queue = set(Buildbot.get_patches_in_queue('Commit-Queue'))
        patch_ids = [
            patch_id for patch_id in set(patch_ids)
            if str(patch_id) not in patches_in_queue
        ]

        patch_ids_to_send = []
        for patch_id in patch_ids:
            patch = Patch.get_patch(patch_id)
            recent_build, _ = StatusBubble().get_latest_build_for_queue(
                patch, 'commit')
            if not recent_build:
                patch_ids_to_send.append(patch_id)
                continue
            recent_build_timestamp = datetime.datetime.fromtimestamp(
                recent_build.complete_at, tz=pytz.UTC)
            cq_timestamp = Bugzilla.get_cq_plus_timestamp(patch_id)
            if not cq_timestamp:
                patch_ids_to_send.append(patch_id)
                continue
            if cq_timestamp > recent_build_timestamp:
                patch_ids_to_send.append(patch_id)
        return patch_ids_to_send
Пример #3
0
    def _build_status(self, patch, queue):
        build, _ = StatusBubble().get_latest_build_for_queue(patch, queue)
        if not build:
            return {}

        return {
            'state':
            build.result,
            'url':
            'https://{}/#/builders/{}/builds/{}'.format(
                config.BUILDBOT_SERVER_HOST, build.builder_id, build.number),
            'timestamp':
            build.complete_at,
        }
Пример #4
0
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# 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 django.conf.urls import url

from ews.views.index import Index
from ews.views.results import Results
from ews.views.statusbubble import StatusBubble
from ews.views.retrypatch import RetryPatch
from ews.views.submittoews import SubmitToEWS

app_name = 'ews'
urlpatterns = [
    # ex: /
    url(r'^$', Index.as_view(), name='index'),
    # ex: /results/
    url(r'^results/$', Results.as_view(), name='results'),
    # ex: /retry/
    url(r'^retry/$', RetryPatch.as_view(), name='retrypatch'),
    # ex: /status-bubble/5
    url(r'^status-bubble/(?P<patch_id>[0-9]+)/$',
        StatusBubble.as_view(),
        name='statusbubble'),
    # ex: /submit-to-ews/
    url(r'^submit-to-ews/$', SubmitToEWS.as_view(), name='submittoews'),
]