app/build: include commit date in JSON output

This adds an RFC 3339 commit date for each revision represented in the
mode=json output of the dashboard. This is shown on the HTML version
of the dashboard, so it's already readily available, and its useful
when scraping the dashboard.

Change-Id: I7683ab76505b3dcd2395f54ec6f904a4a8d56617
Reviewed-on: https://go-review.googlesource.com/9012
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Austin Clements 2015-04-16 18:29:32 -04:00
Родитель 7c87e57d71
Коммит 8b843f189f
2 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -20,6 +20,7 @@ import (
"sort"
"strconv"
"strings"
"time"
"golang.org/x/build/types"
@ -164,6 +165,7 @@ func jsonHandler(w http.ResponseWriter, r *http.Request, data *uiTemplateData) {
rev := types.BuildRevision{
Repo: "go",
Revision: c.Hash,
Date: c.Time.Format(time.RFC3339),
Results: make([]string, len(data.Builders)),
}
for i, b := range data.Builders {
@ -184,6 +186,7 @@ func jsonHandler(w http.ResponseWriter, r *http.Request, data *uiTemplateData) {
Repo: pkgState.Package.Name,
Revision: pkgState.Commit.Hash,
GoRevision: goRev,
Date: pkgState.Commit.Time.Format(time.RFC3339),
Results: make([]string, len(data.Builders)),
}
for i, b := range res.Builders {

Просмотреть файл

@ -33,6 +33,9 @@ type BuildRevision struct {
// Otherwise this is empty.
GoRevision string `json:"goRevision,omitempty"`
// Date is the commit date of this revision, formatted in RFC3339.
Date string `json:"date"`
// Results are the build results for each of the builders in
// the same length slice BuildStatus.Builders.
// Each string is either "" (if no data), "ok", or the URL to failure logs.