Chromium Code Reviews| Index: milo/common/config.go |
| diff --git a/milo/common/config.go b/milo/common/config.go |
| index 9fbbec2f81eacec38822699bbeda7a7783dc6dbb..f036302a18994748d38318e7a9be58a2970db654 100644 |
| --- a/milo/common/config.go |
| +++ b/milo/common/config.go |
| @@ -35,7 +35,7 @@ import ( |
| "github.com/luci/luci-go/milo/api/config" |
| ) |
| -// Console is af datastore entity representing a single console. |
| +// Console is a datastore entity representing a single console. |
| type Console struct { |
| // Parent is a key to the parent Project entity where this console was |
| // defined in. |
| @@ -55,8 +55,17 @@ type Console struct { |
| URL string |
| // Revision is the luci-config reivision from when this Console was retrieved. |
| Revision string |
| - // Builders is a list of universal builder IDs. |
| + // Builders is a list of universal builder IDs. This is indexed. |
| Builders []string |
| + // BuilderMeta is an expanded set of builders containing additional metadata. |
| + // This should always match the Builders field. |
| + BuilderMetas []BuilderMeta |
| +} |
| + |
| +// BuilderMeta is a struct containing metadata about a builder. |
| +type BuilderMeta struct { |
| + Category string |
| + ShortName string |
| } |
| // GetProjectName retrieves the project name of the console out of the Console's |
| @@ -77,6 +86,7 @@ func NewConsole(project *datastore.Key, URL, revision string, con *config.Consol |
| Revision: revision, |
| URL: URL, |
| Builders: BuilderFromProto(con.Builders), |
| + BuilderMetas: BuilderRefFromProto(con.Builders), |
| } |
| } |
| @@ -90,6 +100,19 @@ func BuilderFromProto(cb []*config.Builder) []string { |
| return builders |
| } |
| +// BuilderFromProto tranforms a luci-config proto builder format into the BuilderRef |
| +// format. |
| +func BuilderRefFromProto(cb []*config.Builder) []BuilderMeta { |
|
dnj
2017/08/02 23:33:04
nit: function name needs to match comment
Ryan Tseng
2017/08/03 00:46:12
oops copypasta mistake.
|
| + builders := make([]BuilderMeta, len(cb)) |
| + for i, b := range cb { |
| + builders[i] = BuilderMeta{ |
| + Category: b.Category, |
| + ShortName: b.ShortName, |
| + } |
| + } |
| + return builders |
| +} |
| + |
| // LuciConfigURL returns a user friendly URL that specifies where to view |
| // this console definition. |
| func LuciConfigURL(c context.Context, configSet, path, revision string) string { |
| @@ -348,7 +371,7 @@ func UpdateConsoles(c context.Context) error { |
| } |
| } |
| logging.Infof( |
| - c, "processed %d consoles over %d projects", len(knownProjects), processedConsoles) |
| + c, "processed %d consoles over %d projects", processedConsoles, len(knownProjects)) |
| if len(merr) == 0 { |
| return nil |