1
2 from buildbot.status.web.base import HtmlResource, BuildLineMixin, map_branches
3
4
5
7 """This shows one line per build, combining all builders together. Useful
8 query arguments:
9
10 numbuilds=: how many lines to display
11 builder=: show only builds for this builder. Multiple builder= arguments
12 can be used to see builds from any builder in the set.
13 reload=: reload the page after this many seconds
14 """
15
16 title = "Recent Builds"
17
21
26
28 if "reload" in request.args:
29 try:
30 reload_time = int(request.args["reload"][0])
31 return max(reload_time, 15)
32 except ValueError:
33 pass
34 return None
35
36 - def content(self, req, cxt):
37 status = self.getStatus(req)
38 numbuilds = int(req.args.get("numbuilds", [self.numbuilds])[0])
39 builders = req.args.get("builder", [])
40 branches = [b for b in req.args.get("branch", []) if b]
41
42 g = status.generateFinishedBuilds(builders, map_branches(branches),
43 numbuilds, max_search=numbuilds)
44
45 cxt['refresh'] = self.get_reload_time(req)
46 cxt['num_builds'] = numbuilds
47 cxt['branches'] = branches
48 cxt['builders'] = builders
49
50 builds = cxt['builds'] = []
51 for build in g:
52 builds.append(self.get_line_values(req, build))
53
54 cxt['authz'] = self.getAuthz(req)
55
56
57 building = 0
58 online = 0
59 for bn in builders:
60 builder = status.getBuilder(bn)
61 builder_status = builder.getState()[0]
62 if builder_status == "building":
63 building += 1
64 online += 1
65 elif builder_status != "offline":
66 online += 1
67
68 cxt['num_online'] = online
69 cxt['num_building'] = building
70
71 template = req.site.buildbot_service.templates.get_template('onelineperbuild.html')
72 return template.render(**cxt)
73
74
75
76
77
78
80 - def __init__(self, builder, numbuilds=20):
86
87 - def content(self, req, cxt):
88 numbuilds = int(req.args.get("numbuilds", [self.numbuilds])[0])
89 branches = [b for b in req.args.get("branch", []) if b]
90
91
92 g = self.builder.generateFinishedBuilds(map_branches(branches),
93 numbuilds)
94
95 cxt['builds'] = map(lambda b: self.get_line_values(req, b), g)
96 cxt.update(dict(num_builds=numbuilds,
97 builder_name=self.builder_name,
98 branches=branches))
99
100 template = req.site.buildbot_service.templates.get_template('onelineperbuildonebuilder.html')
101 return template.render(**cxt)
102