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

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

Issue 2946443003: Milo: (Breaking proto change) Update console definition (Closed)
Patch Set: Created 3 years, 6 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
Index: milo/appengine/console/console.go
diff --git a/milo/appengine/console/console.go b/milo/appengine/console/console.go
index 5dfb037470472cac2b02e40a61cc71fec6b80dad..0144313b7e4a811f9992d6d5dda47bec608b2428 100644
--- a/milo/appengine/console/console.go
+++ b/milo/appengine/console/console.go
@@ -15,25 +15,18 @@ import (
"github.com/luci/luci-go/common/logging"
"github.com/luci/luci-go/milo/api/resp"
"github.com/luci/luci-go/milo/appengine/backend/git"
- "github.com/luci/luci-go/milo/appengine/buildbot"
"github.com/luci/luci-go/milo/appengine/common"
+ "github.com/luci/luci-go/milo/appengine/common/model"
"github.com/luci/luci-go/milo/common/config"
"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.
@@ -58,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)
@@ -81,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 {
@@ -94,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{

Powered by Google App Engine
This is Rietveld 408576698