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

Unified Diff: milo/frontend/console/console.go

Issue 2946443003: Milo: (Breaking proto change) Update console definition (Closed)
Patch Set: ImportFix Created 3 years, 5 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/common/config_test.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/frontend/console/console.go
diff --git a/milo/frontend/console/console.go b/milo/frontend/console/console.go
index ed701dde47fc423dfff1266b84f25daa23cface7..948eb49f7b22c2473612ff412027be846c17c812 100644
--- a/milo/frontend/console/console.go
+++ b/milo/frontend/console/console.go
@@ -13,28 +13,20 @@ import (
"github.com/luci/luci-go/common/clock"
"github.com/luci/luci-go/common/logging"
- "github.com/luci/luci-go/server/router"
-
"github.com/luci/luci-go/milo/api/config"
"github.com/luci/luci-go/milo/api/resp"
- "github.com/luci/luci-go/milo/buildsource/buildbot"
"github.com/luci/luci-go/milo/common"
"github.com/luci/luci-go/milo/common/gitiles"
+ "github.com/luci/luci-go/milo/common/model"
+ "github.com/luci/luci-go/server/router"
)
// Returns results of build[commit_index][builder_index]
func GetConsoleBuilds(
- c context.Context, module string,
- builders []resp.BuilderRef, commits []string) (
- [][]*resp.ConsoleBuild, error) {
+ c context.Context, builders []resp.BuilderRef, commits []string) (
+ [][]*model.BuildSummary, error) {
- switch module {
- case "buildbot":
- return buildbot.GetConsoleBuilds(c, builders, commits)
- // The case for buildbucket and dm goes here.
- default:
- panic(fmt.Errorf("Unrecognized module %s", module))
- }
+ panic("Nothing to see here, check back later.")
}
// getConsoleDef finds the console definition as defined by any project.
@@ -59,6 +51,18 @@ func Main(ctx *router.Context) {
return
}
+func summaryToConsole(bs []*model.BuildSummary) []*resp.ConsoleBuild {
+ cb := make([]*resp.ConsoleBuild, 0, len(bs))
+ for _, b := range bs {
+ cb = append(cb, &resp.ConsoleBuild{
+ // TODO(hinoka): This should link to the actual build.
+ Link: resp.NewLink(b.BuildKey.String(), "#"),
+ Status: b.Summary.Status,
+ })
+ }
+ return cb
+}
+
func console(c context.Context, project, name string) (*resp.Console, error) {
tStart := clock.Now(c)
def, err := getConsoleDef(c, project, name)
@@ -82,10 +86,10 @@ func console(c context.Context, project, name string) (*resp.Console, error) {
builders := make([]resp.BuilderRef, len(def.Builders))
for i, b := range def.Builders {
builders[i] = resp.BuilderRef{
- b.Module, b.Name, strings.Split(b.Category, "|"), b.ShortName,
+ b.Name, strings.Split(b.Category, "|"), b.ShortName,
}
}
- cb, err := GetConsoleBuilds(c, "buildbot", builders, commitNames)
+ cb, err := GetConsoleBuilds(c, builders, commitNames)
tConsole := clock.Now(c)
logging.Debugf(c, "Loading the console took a total of %s.", tConsole.Sub(tGitiles))
if err != nil {
@@ -95,7 +99,7 @@ func console(c context.Context, project, name string) (*resp.Console, error) {
for i, commit := range commitLinks {
// TODO(hinoka): Not like this
ccb[i].Commit = resp.Commit{Revision: commit}
- ccb[i].Build = cb[i]
+ ccb[i].Build = summaryToConsole(cb[i])
}
cs := &resp.Console{
« no previous file with comments | « milo/common/config_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698