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

Side by Side Diff: milo/frontend/config.go

Issue 2955223002: Milo: Buildbucket PubSub ingestion outline (Closed)
Patch Set: rebase 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 unified diff | Download patch
« no previous file with comments | « milo/common/pubsub_test.go ('k') | milo/frontend/main.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package frontend 5 package frontend
6 6
7 import ( 7 import (
8 "net/http" 8 "net/http"
9 9
10 "cloud.google.com/go/datastore" 10 "cloud.google.com/go/datastore"
11 "google.golang.org/appengine"
11 12
12 "github.com/luci/luci-go/common/logging" 13 "github.com/luci/luci-go/common/logging"
13 "github.com/luci/luci-go/milo/common" 14 "github.com/luci/luci-go/milo/common"
14 "github.com/luci/luci-go/server/router" 15 "github.com/luci/luci-go/server/router"
15 "github.com/luci/luci-go/server/templates" 16 "github.com/luci/luci-go/server/templates"
16 ) 17 )
17 18
18 // ConfigsHandler renders the page showing the currently loaded set of luci-conf igs. 19 // ConfigsHandler renders the page showing the currently loaded set of luci-conf igs.
19 func ConfigsHandler(c *router.Context) { 20 func ConfigsHandler(c *router.Context) {
20 projects, err := common.GetAllProjects(c.Context) 21 projects, err := common.GetAllProjects(c.Context)
(...skipping 13 matching lines...) Expand all
34 35
35 templates.MustRender(c.Context, c.Writer, "pages/configs.html", template s.Args{ 36 templates.MustRender(c.Context, c.Writer, "pages/configs.html", template s.Args{
36 "Projects": projects, 37 "Projects": projects,
37 "ServiceConfig": sc, 38 "ServiceConfig": sc,
38 }) 39 })
39 } 40 }
40 41
41 // UpdateHandler is an HTTP handler that handles configuration update requests. 42 // UpdateHandler is an HTTP handler that handles configuration update requests.
42 func UpdateConfigHandler(ctx *router.Context) { 43 func UpdateConfigHandler(ctx *router.Context) {
43 c, h := ctx.Context, ctx.Writer 44 c, h := ctx.Context, ctx.Writer
45 // Needed to access the PubSub API
46 c = appengine.WithContext(c, ctx.Request)
44 projErr := common.UpdateProjectConfigs(c) 47 projErr := common.UpdateProjectConfigs(c)
45 if projErr != nil { 48 if projErr != nil {
46 logging.WithError(projErr).Errorf(c, "project update handler enc ountered error") 49 logging.WithError(projErr).Errorf(c, "project update handler enc ountered error")
47 } 50 }
48 » servErr := common.UpdateServiceConfig(c) 51 » settings, servErr := common.UpdateServiceConfig(c)
49 if servErr != nil { 52 if servErr != nil {
50 logging.WithError(servErr).Errorf(c, "service update handler enc ountered error") 53 logging.WithError(servErr).Errorf(c, "service update handler enc ountered error")
54 } else {
55 servErr = common.EnsurePubSubSubscribed(c, settings)
56 if servErr != nil {
57 logging.WithError(servErr).Errorf(
58 c, "pubsub subscriber handler encountered error" )
59 }
51 } 60 }
52 if projErr != nil || servErr != nil { 61 if projErr != nil || servErr != nil {
53 h.WriteHeader(http.StatusInternalServerError) 62 h.WriteHeader(http.StatusInternalServerError)
54 return 63 return
55 } 64 }
56 h.WriteHeader(http.StatusOK) 65 h.WriteHeader(http.StatusOK)
57 } 66 }
OLDNEW
« no previous file with comments | « milo/common/pubsub_test.go ('k') | milo/frontend/main.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698