mirror of
https://github.com/golang/go
synced 2024-11-21 19:54:41 -07:00
godashboard: fiddling
* some tweaks to dashboard html/css layout * use hmac to generate per-builder subkeys R=agl1 CC=golang-dev https://golang.org/cl/194092
This commit is contained in:
parent
f39dc9fff2
commit
e0afb0c38b
@ -12,6 +12,7 @@ from google.appengine.ext.webapp.util import run_wsgi_app
|
||||
import binascii
|
||||
import datetime
|
||||
import hashlib
|
||||
import hmac
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
@ -70,21 +71,29 @@ class MainPage(webapp.RequestHandler):
|
||||
results = q.fetch(30)
|
||||
|
||||
revs = [toRev(r) for r in results]
|
||||
allbuilders = set()
|
||||
builders = {}
|
||||
|
||||
for r in revs:
|
||||
for b in r['builds']:
|
||||
allbuilders.add(b['builder'])
|
||||
f = b['builder'].split('-', 3)
|
||||
goos = f[0]
|
||||
goarch = f[1]
|
||||
note = ""
|
||||
if len(f) > 2:
|
||||
note = f[2]
|
||||
builders[b['builder']] = {'goos': goos, 'goarch': goarch, 'note': note}
|
||||
|
||||
for r in revs:
|
||||
have = set(x['builder'] for x in r['builds'])
|
||||
need = allbuilders.difference(have)
|
||||
need = set(builders.keys()).difference(have)
|
||||
for n in need:
|
||||
r['builds'].append({'builder': n, 'log':'', 'ok': False})
|
||||
r['builds'].sort(cmp = byBuilder)
|
||||
r['shortdesc'] = r['desc'].split('\n', 2)[0]
|
||||
|
||||
builders = list(allbuilders)
|
||||
builders = list(builders.items())
|
||||
builders.sort()
|
||||
values = {"revs": revs, "builders": builders}
|
||||
values = {"revs": revs, "builders": [v for k,v in builders]}
|
||||
|
||||
path = os.path.join(os.path.dirname(__file__), 'main.html')
|
||||
self.response.out.write(template.render(path, values))
|
||||
@ -107,9 +116,13 @@ class GetHighwater(webapp.RequestHandler):
|
||||
self.response.set_status(200)
|
||||
self.response.out.write(hw.commit)
|
||||
|
||||
def auth(req):
|
||||
k = req.get('key')
|
||||
return k == hmac.new(key.accessKey, req.get('builder')).hexdigest() or k == key.accessKey
|
||||
|
||||
class SetHighwater(webapp.RequestHandler):
|
||||
def post(self):
|
||||
if self.request.get('key') != key.accessKey:
|
||||
if not auth(self.request):
|
||||
self.response.set_status(403)
|
||||
return
|
||||
|
||||
@ -141,7 +154,7 @@ class LogHandler(webapp.RequestHandler):
|
||||
# it cannot be created by Build.
|
||||
class Init(webapp.RequestHandler):
|
||||
def post(self):
|
||||
if self.request.get('key') != key.accessKey:
|
||||
if not auth(self.request):
|
||||
self.response.set_status(403)
|
||||
return
|
||||
|
||||
@ -167,7 +180,7 @@ class Init(webapp.RequestHandler):
|
||||
# Build is the main command: it records the result of a new build.
|
||||
class Build(webapp.RequestHandler):
|
||||
def post(self):
|
||||
if self.request.get('key') != key.accessKey:
|
||||
if not auth(self.request):
|
||||
self.response.set_status(403)
|
||||
return
|
||||
|
||||
@ -248,7 +261,7 @@ class Benchmarks(webapp.RequestHandler):
|
||||
self.response.out.write(']}\n')
|
||||
|
||||
def post(self):
|
||||
if self.request.get('key') != key.accessKey:
|
||||
if not auth(self.request):
|
||||
self.response.set_status(403)
|
||||
return
|
||||
|
||||
@ -414,7 +427,7 @@ application = webapp.WSGIApplication(
|
||||
('/build', Build),
|
||||
('/benchmarks', Benchmarks),
|
||||
('/benchmarks/.*', GetBenchmarks),
|
||||
])
|
||||
], debug=True)
|
||||
|
||||
def main():
|
||||
run_wsgi_app(application)
|
||||
|
@ -1,16 +1,20 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Go build</title>
|
||||
<title>Go dashboard</title>
|
||||
|
||||
<style>
|
||||
td.revision {
|
||||
font-family: monospace;
|
||||
h1 {
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
h2 {
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
table.alternate {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.alternate tr td {
|
||||
padding-right: 10px;
|
||||
}
|
||||
@ -18,40 +22,50 @@
|
||||
padding-right: 0;
|
||||
}
|
||||
table.alternate tr:nth-child(2n) {
|
||||
background-color: #eef;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
td.revision {
|
||||
}
|
||||
span.hash {
|
||||
font-family: monospace;
|
||||
font-size: small;
|
||||
color: #aaa;
|
||||
}
|
||||
span.nodeseq {
|
||||
}
|
||||
td.user {
|
||||
font-family: monospace;
|
||||
font-size: small;
|
||||
}
|
||||
td.date {
|
||||
font-size: 0.8em;
|
||||
color: #aaa;
|
||||
font-size: small;
|
||||
}
|
||||
td.result {
|
||||
text-align: center;
|
||||
}
|
||||
span.ok {
|
||||
}
|
||||
td.desc {
|
||||
font-size: 0.9em;
|
||||
font-size: small;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
th.builder {
|
||||
font-variant: small-caps;
|
||||
font-size: 1.2em;
|
||||
color: #966;
|
||||
padding-right: 1em;
|
||||
}
|
||||
span.ok {
|
||||
color: green;
|
||||
font-weight: bold;
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Go dashboard</h1>
|
||||
|
||||
<h2>Build status</h2>
|
||||
<table class="alternate" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
{% for b in builders %}
|
||||
<th class="builder">{{b}}</th>
|
||||
{% endfor %}
|
||||
<th></th>
|
||||
{% for b in builders %}
|
||||
<th class="builder">{{b.goos}}<br>{{b.goarch}}<br>{{b.note}}</th>
|
||||
{% endfor %}
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
@ -59,13 +73,15 @@
|
||||
|
||||
{% for r in revs %}
|
||||
<tr>
|
||||
<td class="revision"><span class="hash"><a href="https://code.google.com/p/go/source/detail?r={{r.node}}">{{r.node|slice:":12"}}</a></span></td>
|
||||
|
||||
{% for b in r.builds %}
|
||||
<td class="result">
|
||||
{% if b.ok %}
|
||||
<span class="ok">☺</span>
|
||||
<span class="ok">ok</span>
|
||||
{% else %}
|
||||
{% if b.log %}
|
||||
<a href="/log/{{b.log}}">failed</a>
|
||||
<a href="/log/{{b.log}}">fail</a>
|
||||
{% else %}
|
||||
<span/>
|
||||
{% endif %}
|
||||
@ -73,10 +89,9 @@
|
||||
</td>
|
||||
{% endfor %}
|
||||
|
||||
<td class="revision"><a href="https://code.google.com/p/go/source/detail?r={{r.node}}">{{r.node|slice:":12"}}</a></td>
|
||||
<td class="user">{{r.user|escape}}</td>
|
||||
<td class="date">{{r.date|escape}}</td>
|
||||
<td class="desc">{{r.desc|escape}}</td>
|
||||
<td class="desc">{{r.shortdesc|escape}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
Loading…
Reference in New Issue
Block a user