Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(740)

Side by Side Diff: milo/appengine/buildbot/builder.go

Issue 2407153006: Milo: Add builder name to builder page (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package buildbot 5 package buildbot
6 6
7 import ( 7 import (
8 "encoding/json" 8 "encoding/json"
9 "fmt" 9 "fmt"
10 "sort" 10 "sort"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 } 108 }
109 return results 109 return results
110 } 110 }
111 111
112 // builderImpl is the implementation for getting a milo builder page from buildb ot. 112 // builderImpl is the implementation for getting a milo builder page from buildb ot.
113 // This gets: 113 // This gets:
114 // * Current Builds from querying the master json from the datastore. 114 // * Current Builds from querying the master json from the datastore.
115 // * Recent Builds from a cron job that backfills the recent builds. 115 // * Recent Builds from a cron job that backfills the recent builds.
116 func builderImpl(c context.Context, masterName, builderName string) (*resp.Build er, error) { 116 func builderImpl(c context.Context, masterName, builderName string) (*resp.Build er, error) {
117 » result := &resp.Builder{} 117 » result := &resp.Builder{
118 » » Name: builderName,
119 » }
118 master, t, err := getMasterJSON(c, masterName) 120 master, t, err := getMasterJSON(c, masterName)
119 switch { 121 switch {
120 case err == ds.ErrNoSuchEntity: 122 case err == ds.ErrNoSuchEntity:
121 return nil, errMasterNotFound 123 return nil, errMasterNotFound
122 case err != nil: 124 case err != nil:
123 return nil, err 125 return nil, err
124 } 126 }
125 if clock.Now(c).Sub(t) > 2*time.Minute { 127 if clock.Now(c).Sub(t) > 2*time.Minute {
126 warning := fmt.Sprintf( 128 warning := fmt.Sprintf(
127 "WARNING: Master data is stale (last updated %s)", t) 129 "WARNING: Master data is stale (last updated %s)", t)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 184
183 for _, fb := range recentBuilds { 185 for _, fb := range recentBuilds {
184 // Yes recent builds is synonymous with finished builds. 186 // Yes recent builds is synonymous with finished builds.
185 // TODO(hinoka): Implement limits. 187 // TODO(hinoka): Implement limits.
186 if fb != nil { 188 if fb != nil {
187 result.FinishedBuilds = append(result.FinishedBuilds, fb ) 189 result.FinishedBuilds = append(result.FinishedBuilds, fb )
188 } 190 }
189 } 191 }
190 return result, nil 192 return result, nil
191 } 193 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698