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

Unified Diff: milo/common/config.go

Issue 2991243002: Milo: Console improvements (Closed)
Patch Set: Review comments Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « milo/buildsource/buildbucket/pubsub.go ('k') | milo/common/model/build_summary.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/common/config.go
diff --git a/milo/common/config.go b/milo/common/config.go
index 9fbbec2f81eacec38822699bbeda7a7783dc6dbb..fcfdf7412709592a0ae65bc251a8ceb938c04b0a 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
}
+// BuilderRefFromProto tranforms a luci-config proto builder format into the
+// BuilderMeta format.
+func BuilderRefFromProto(cb []*config.Builder) []BuilderMeta {
+ 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
« no previous file with comments | « milo/buildsource/buildbucket/pubsub.go ('k') | milo/common/model/build_summary.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698