How to use the buildbot.status.web.base.HtmlResource function in buildbot

To help you get started, we’ve selected a few buildbot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github buildbot / buildbot / buildbot / status / web / tests.py View on Github external
def __init__(self, build_status):
        HtmlResource.__init__(self)
        self.build_status = build_status
        self.test_results = build_status.getTestResults()
github buildbot / buildbot / master / buildbot / status / web / build.py View on Github external
def __init__(self, build_status):
        HtmlResource.__init__(self)
        self.build_status = build_status
github buildbot / buildbot / master / buildbot / status / web / builder.py View on Github external
def buildForceContext(cxt, req, master, buildername=None):
    force_schedulers = {}
    default_props = collections.defaultdict(str)
    for sch in master.allSchedulers():
        if isinstance(sch, ForceScheduler) and (buildername is None or(buildername in sch.builderNames)):
            force_schedulers[sch.name] = sch
            for field in sch.all_fields:
                buildForceContextForField(req, default_props, sch, field, master, buildername)

    cxt['force_schedulers'] = force_schedulers
    cxt['default_props'] = default_props

# /builders/$builder


class StatusResourceBuilder(HtmlResource, BuildLineMixin):
    addSlash = True

    def __init__(self, builder_status, numbuilds=20):
        HtmlResource.__init__(self)
        self.builder_status = builder_status
        self.numbuilds = numbuilds

    def getPageTitle(self, request):
        return "Buildbot: %s" % self.builder_status.getName()

    def builder(self, build, req):
        b = {}

        b['num'] = build.getNumber()
        b['link'] = path_to_build(req, build)
github buildbot / buildbot / master / buildbot / status / web / users.py View on Github external
d = status.master.db.users.getUser(self.uid)
        def cb(usdict):
            ctx['user_identifier'] = usdict['identifier']
            user = ctx['user'] = {}
            for attr in usdict:
                if attr not in ['uid', 'identifier', 'bb_password']:
                    user[attr] = usdict[attr]

            template = request.site.buildbot_service.templates.get_template("user.html")
            data = template.render(**ctx)
            return data
        d.addCallback(cb)
        return d

# /users
class UsersResource(HtmlResource):
    pageTitle = "Users"
    addSlash = True

    def __init__(self):
        HtmlResource.__init__(self)

    def getChild(self, path, req):
        return OneUserResource(path)

    @defer.inlineCallbacks
    def content(self, req, ctx):
        res = yield self.getAuthz(req).actionAllowed('showUsersPage', req)
        if not res:
            defer.returnValue(redirectTo(path_to_authzfail(req), req))
            return
github buildbot / buildbot / master / buildbot / status / web / status_json.py View on Github external
output.append('<a href="' + html.escape(line_full) + '">' +
                          html.escape(line) + '</a>')
        else:
            output.append(html.escape(line).replace('  ', '&nbsp;&nbsp;'))
        if not in_item:
            output.append('<br>')

    if in_item:
        output.append('')
    while indent &gt; 0:
        output.append('')
        indent -= 2
    return '\n'.join(output)


class HelpResource(HtmlResource):

    def __init__(self, text, pageTitle, parent_node):
        HtmlResource.__init__(self)
        self.text = text
        self.pageTitle = pageTitle
        self.parent_level = parent_node.level
        self.parent_children = parent_node.children.keys()

    def content(self, request, cxt):
        cxt['level'] = self.parent_level
        cxt['text'] = ToHtml(self.text)
        cxt['children'] = [n for n in self.parent_children if n != 'help']
        cxt['flags'] = ToHtml(FLAGS)
        cxt['examples'] = ToHtml(EXAMPLES).replace(
            'href="/json',
            'href="%s' % path_to_root(request) + 'json')
github google / skia-buildbot / master / skia_master_scripts / monkeypatches.py View on Github external
request.setHeader("content-type", self.contentType)
    if request.method == "HEAD":
      request.setHeader("content-length", len(data))
      return ''
    return data
  d.addCallback(handle)
  def ok(data):
    request.write(data)
    request.finish()
  def fail(f):
    request.processingFailed(f)
    return None # processingFailed will log this for us
  d.addCallbacks(ok, fail)
  return server.NOT_DONE_YET

webstatus_base.HtmlResource.render = HtmlResourceRender


class TryBuildersJsonResource(JsonResource):
  """ Clone of buildbot.status.web.status_json.BuildersJsonResource:
  http://src.chromium.org/viewvc/chrome/trunk/tools/build/third_party/buildbot_8_4p1/buildbot/status/web/status_json.py?view=markup

  We add filtering to display only the try builders.
  """
  help = """List of all the try builders defined on a master."""
  pageTitle = 'Builders'

  def __init__(self, status, include_only_cq_trybots=False):
    JsonResource.__init__(self, status)
    for builder_name in self.status.getBuilderNames():
      if builder_name_schema.IsTrybot(builder_name) and (
          not include_only_cq_trybots or builder_name in slaves_cfg.CQ_TRYBOTS):
github buildbot / buildbot / master / buildbot / status / web / builder.py View on Github external
def getChild(self, path, req):
        if path == "force":
            return ForceBuildActionResource(self.builder_status)
        if path == "ping":
            return self.ping(req)
        if path == "cancelbuild":
            return CancelChangeResource(self.builder_status)
        if path == "stopchange":
            return StopChangeResource(self.builder_status)
        if path == "builds":
            return BuildsResource(self.builder_status)

        return HtmlResource.getChild(self, path, req)
github GNOME / jhbuild / jhbuild / buildbot / status / web / step.py View on Github external
def getChild(self, path, req):
        if path == 'logs':
            return JhLogsResource(self.step_status)
        return HtmlResource.getChild(self, path, req)
github buildbot / buildbot_travis / buildbot_travis / status / add_project.py View on Github external
from twisted.python import log
from twisted.internet import reactor
from buildbot.status.web.base import HtmlResource, ActionResource

import os
import shelve
import re


class AddProjectForm(HtmlResource):

    def content(self, req, cxt):
        template = req.site.buildbot_service.templates.get_template(
            "travis.add.html")
        # return (template.render(**cxt))
        return template.render(cxt)


class AddProject(ActionResource):

    def __init__(self, status, path):
        self.status = status
        self.path = path

    def performAction(self, req):
        CAME_FROM = "/add_form"
github buildbot / buildbot / master / buildbot / status / web / status_json.py View on Github external
def __init__(self, text, pageTitle, parent_node):
        HtmlResource.__init__(self)
        self.text = text
        self.pageTitle = pageTitle
        self.parent_level = parent_node.level
        self.parent_children = parent_node.children.keys()