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 got = 0
51 building = 0
52 online = 0
53
54 builders = cxt['builds'] = []
55 for build in g:
56 got += 1
57 builders.append(self.get_line_values(req, build))
58 builder_status = build.getBuilder().getState()[0]
59 if builder_status == "building":
60 building += 1
61 online += 1
62 elif builder_status != "offline":
63 online += 1
64
65 cxt['authz'] = self.getAuthz(req)
66 cxt['num_online'] = online
67 cxt['num_building'] = building
68
69 template = req.site.buildbot_service.templates.get_template('onelineperbuild.html')
70 return template.render(**cxt)
71
72
73
74
75
76
78 - def __init__(self, builder, numbuilds=20):
84
85 - def content(self, req, cxt):
86 numbuilds = int(req.args.get("numbuilds", [self.numbuilds])[0])
87 branches = [b for b in req.args.get("branch", []) if b]
88
89
90 g = self.builder.generateFinishedBuilds(map_branches(branches),
91 numbuilds)
92
93 cxt['builds'] = map(lambda b: self.get_line_values(req, b), g)
94 cxt.update(dict(num_builds=numbuilds,
95 builder_name=self.builder_name,
96 branches=branches))
97
98 template = req.site.buildbot_service.templates.get_template('onelineperbuildonebuilder.html')
99 return template.render(**cxt)
100