cmd/coordinator: generate table of builders
To replace the always-out-of-date wiki.
Change-Id: I63d56d4bcf9252e56c833eaa15656b0321ac91dc
Reviewed-on: https://go-review.googlesource.com/9571
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/cmd/coordinator/builders.go b/cmd/coordinator/builders.go
new file mode 100644
index 0000000..38d8ad2
--- /dev/null
+++ b/cmd/coordinator/builders.go
@@ -0,0 +1,54 @@
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+ "bytes"
+ "net/http"
+ "text/template"
+
+ "golang.org/x/build/dashboard"
+)
+
+func handleBuilders(w http.ResponseWriter, r *http.Request) {
+ var buf bytes.Buffer
+ if err := buildersTmpl.Execute(&buf, dashboard.Builders); err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+ buf.WriteTo(w)
+}
+
+var buildersTmpl = template.Must(template.New("builders").Parse(`
+<!DOCTYPE html>
+<html>
+<head><link rel="stylesheet" href="/style.css"/><title>Go Farmer</title></head>
+<body>
+<header>
+ <h1>Go Build Coordinator</h1>
+ <nav>
+ <a href="http://build.golang.org">Dashboard</a>
+ <a href="/builders">Builders</a>
+ </nav>
+ <div class="clear"></div>
+</header>
+
+<h2>Defined Builders</h2>
+
+<table>
+<thead><tr><th>name</th><th>pool</th><th>owner</th><th>notes</th></tr>
+</thead>
+{{range .}}
+<tr>
+ <td>{{.Name}}</td>
+ <td>{{if .IsReverse}}Reverse{{else}}GCE{{end}}</td>
+ <td>{{.ShortOwner}}</td>
+ <td>{{.Notes}}</td>
+</tr>
+{{end}}
+</table>
+</body>
+</html>
+`))
diff --git a/cmd/coordinator/coordinator.go b/cmd/coordinator/coordinator.go
index 9c1d7f8..b6cd412 100644
--- a/cmd/coordinator/coordinator.go
+++ b/cmd/coordinator/coordinator.go
@@ -258,11 +258,12 @@
}
http.HandleFunc("/", handleStatus)
- http.HandleFunc("/try", handleTryStatus)
- http.HandleFunc("/logs", handleLogs)
http.HandleFunc("/debug/goroutines", handleDebugGoroutines)
+ http.HandleFunc("/builders", handleBuilders)
+ http.HandleFunc("/logs", handleLogs)
http.HandleFunc("/reverse", handleReverse)
http.HandleFunc("/style.css", handleStyleCSS)
+ http.HandleFunc("/try", handleTryStatus)
go func() {
if *mode == "dev" {
return
diff --git a/cmd/coordinator/status.go b/cmd/coordinator/status.go
index a9cc93a..28dd321 100644
--- a/cmd/coordinator/status.go
+++ b/cmd/coordinator/status.go
@@ -182,4 +182,19 @@
border: 1px solid #375EAB;
border-radius: 5px;
}
+
+table {
+ border-collapse: collapse;
+ font-size: 9pt;
+}
+
+table td, table th, table td, table th {
+ text-align: left;
+ vertical-align: top;
+ padding: 2px 6px;
+}
+
+table thead tr {
+ background: #fff !important;
+}
`