From 8b843f189f5e5c67efa26bfbde0b085a95701205 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Thu, 16 Apr 2015 18:29:32 -0400 Subject: [PATCH] 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 --- app/build/ui.go | 3 +++ types/types.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/build/ui.go b/app/build/ui.go index 27fcb539..9424a3d5 100644 --- a/app/build/ui.go +++ b/app/build/ui.go @@ -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 { diff --git a/types/types.go b/types/types.go index b8dfa48c..a2b2d5a4 100644 --- a/types/types.go +++ b/types/types.go @@ -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.