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

Unified Diff: milo/appengine/buildbot/master.go

Issue 2271453002: Milo: Internal buildbot masters support (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: nit fix Created 4 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/appengine/buildbot/builder.go ('k') | milo/appengine/buildbot/pubsub.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/buildbot/master.go
diff --git a/milo/appengine/buildbot/master.go b/milo/appengine/buildbot/master.go
index a31cf96fcec93116d35ee2c3fdb35f783fdc9ac3..629f0da4be3d388a8c4e9122f73c99ab341f8dd1 100644
--- a/milo/appengine/buildbot/master.go
+++ b/milo/appengine/buildbot/master.go
@@ -13,8 +13,9 @@ import (
"time"
"github.com/luci/gae/service/datastore"
- log "github.com/luci/luci-go/common/logging"
+ "github.com/luci/luci-go/common/logging"
"github.com/luci/luci-go/milo/api/resp"
+ "github.com/luci/luci-go/milo/appengine/settings"
"golang.org/x/net/context"
)
@@ -43,7 +44,7 @@ func getMasterJSON(c context.Context, name string) (
ds := datastore.Get(c)
err = ds.Get(&entry)
if err != nil {
- log.WithError(err).Errorf(
+ logging.WithError(err).Errorf(
c, "Encountered error while fetching entry for %s:\n%s", name, err)
return
}
@@ -60,8 +61,6 @@ func GetAllBuilders(c context.Context) (*resp.Module, error) {
// Fetch all Master entries from datastore
ds := datastore.Get(c)
q := datastore.NewQuery("buildbotMasterEntry")
- // TODO(hinoka): Support internal queries.
- q = q.Eq("Internal", false)
// TODO(hinoka): Maybe don't look past like a month or so?
entries := []*buildbotMasterEntry{}
err := ds.GetAll(q, &entries)
@@ -72,14 +71,25 @@ func GetAllBuilders(c context.Context) (*resp.Module, error) {
// Add each builder from each master entry into the result.
// TODO(hinoka): FanInOut this?
for _, entry := range entries {
+ if entry.Internal {
+ // Bypass the master if it's an internal master and the user is not
+ // part of the buildbot-private project.
+ allowed, err := settings.IsAllowedInternal(c)
+ if err != nil {
+ logging.WithError(err).Errorf(c, "Could not process master %s", entry.Name)
+ return nil, err
+ }
+ if !allowed {
+ continue
+ }
+ }
master := &buildbotMaster{}
err = decodeMasterEntry(c, entry, master)
if err != nil {
- log.WithError(err).Errorf(c, "Could not decode %s", entry.Name)
+ logging.WithError(err).Errorf(c, "Could not decode %s", entry.Name)
continue
}
ml := resp.MasterListing{Name: entry.Name}
- // TODO(hinoka): Sort
// Sort the builder listing.
sb := make([]string, 0, len(master.Builders))
for bn := range master.Builders {
« no previous file with comments | « milo/appengine/buildbot/builder.go ('k') | milo/appengine/buildbot/pubsub.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698