Chromium Code Reviews| Index: status/go/status/main.go |
| diff --git a/status/go/status/main.go b/status/go/status/main.go |
| index f77b2da238eca9b4e7d863dd666ab4f9d058df9b..84b0f0b0f5b4f095e42555130fab5f3eb2659236 100644 |
| --- a/status/go/status/main.go |
| +++ b/status/go/status/main.go |
| @@ -25,6 +25,7 @@ import ( |
| ) |
| import ( |
| + "go.skia.org/infra/go/autoroll" |
| "go.skia.org/infra/go/buildbot" |
| "go.skia.org/infra/go/common" |
| "go.skia.org/infra/go/gitinfo" |
| @@ -56,6 +57,7 @@ var ( |
| goldSKPStatus *util.IntPollingStatus = nil |
| goldImageStatus *util.IntPollingStatus = nil |
| perfStatus *util.PollingStatus = nil |
| + rollStatus *util.PollingStatus = nil |
| slaveHosts *util.PollingStatus = nil |
| androidDevices *util.PollingStatus = nil |
| sshDevices *util.PollingStatus = nil |
| @@ -417,6 +419,14 @@ func goldJsonHandler(w http.ResponseWriter, r *http.Request) { |
| } |
| } |
| +func autoRollJsonHandler(w http.ResponseWriter, r *http.Request) { |
| + w.Header().Set("Content-Type", "application/json") |
| + if err := json.NewEncoder(w).Encode(rollStatus); err != nil { |
| + util.ReportError(w, r, err, fmt.Sprintf("Failed to report AutoRoll status: %v", err)) |
| + return |
| + } |
| +} |
| + |
| func slaveHostsJsonHandler(w http.ResponseWriter, r *http.Request) { |
| w.Header().Set("Content-Type", "application/json") |
| if err := json.NewEncoder(w).Encode(map[string]interface{}{ |
| @@ -460,6 +470,7 @@ func runServer(serverURL string) { |
| commits.HandleFunc("/{commit:[a-f0-9]+}/comments", addCommitCommentHandler).Methods("POST") |
| r.HandleFunc("/json/perfAlerts", perfJsonHandler) |
| r.HandleFunc("/json/goldStatus", goldJsonHandler) |
| + r.HandleFunc("/json/autoRoll", autoRollJsonHandler) |
|
rmistry
2015/06/10 20:20:54
sort the HandleFuncs ?
borenet
2015/06/11 11:40:10
Done.
|
| r.HandleFunc("/json/slaveHosts", slaveHostsJsonHandler) |
| r.HandleFunc("/json/version", skiaversion.JsonHandler) |
| r.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler) |
| @@ -583,5 +594,11 @@ func main() { |
| glog.Fatal(err) |
| } |
| + // Load AutoRoll data in a loop. |
| + rollStatus, err = autoroll.AutoRollStatusPoller() |
| + if err != nil { |
| + glog.Fatal(err) |
| + } |
| + |
| runServer(serverURL) |
| } |