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