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

Side by Side Diff: scheduler/appengine/frontend/handler.go

Issue 2986033003: [scheduler]: ACLs phase 1 - per Job ACL specification and enforcement. (Closed)
Patch Set: Review. 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 unified diff | Download patch
« no previous file with comments | « scheduler/appengine/engine/engine_test.go ('k') | scheduler/appengine/messages/cron.proto » ('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. 1 // Copyright 2015 The LUCI Authors.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 "github.com/luci/luci-go/scheduler/appengine/task/noop" 59 "github.com/luci/luci-go/scheduler/appengine/task/noop"
60 "github.com/luci/luci-go/scheduler/appengine/task/swarming" 60 "github.com/luci/luci-go/scheduler/appengine/task/swarming"
61 "github.com/luci/luci-go/scheduler/appengine/task/urlfetch" 61 "github.com/luci/luci-go/scheduler/appengine/task/urlfetch"
62 "github.com/luci/luci-go/scheduler/appengine/ui" 62 "github.com/luci/luci-go/scheduler/appengine/ui"
63 ) 63 )
64 64
65 //// Global state. See init(). 65 //// Global state. See init().
66 66
67 var ( 67 var (
68 globalCatalog catalog.Catalog 68 globalCatalog catalog.Catalog
69 » globalEngine engine.Engine 69 » globalEngine engine.EngineInternal
70 70
71 // Known kinds of tasks. 71 // Known kinds of tasks.
72 managers = []task.Manager{ 72 managers = []task.Manager{
73 &buildbucket.TaskManager{}, 73 &buildbucket.TaskManager{},
74 &gitiles.TaskManager{}, 74 &gitiles.TaskManager{},
75 &noop.TaskManager{}, 75 &noop.TaskManager{},
76 &swarming.TaskManager{}, 76 &swarming.TaskManager{},
77 &urlfetch.TaskManager{}, 77 &urlfetch.TaskManager{},
78 } 78 }
79 ) 79 )
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 next(c) 156 next(c)
157 }, 157 },
158 ) 158 )
159 159
160 // Setup HTTP routes. 160 // Setup HTTP routes.
161 r := router.New() 161 r := router.New()
162 162
163 gaemiddleware.InstallHandlersWithMiddleware(r, base) 163 gaemiddleware.InstallHandlersWithMiddleware(r, base)
164 164
165 ui.InstallHandlers(r, base, ui.Config{ 165 ui.InstallHandlers(r, base, ui.Config{
166 » » Engine: globalEngine, 166 » » Engine: globalEngine.PublicAPI(),
167 Catalog: globalCatalog, 167 Catalog: globalCatalog,
168 TemplatesPath: "templates", 168 TemplatesPath: "templates",
169 }) 169 })
170 170
171 r.POST("/pubsub", base, pubsubPushHandler) // auth is via custom tokens 171 r.POST("/pubsub", base, pubsubPushHandler) // auth is via custom tokens
172 r.GET("/internal/cron/read-config", base.Extend(gaemiddleware.RequireCro n), readConfigCron) 172 r.GET("/internal/cron/read-config", base.Extend(gaemiddleware.RequireCro n), readConfigCron)
173 r.POST("/internal/tasks/read-project-config", base.Extend(gaemiddleware. RequireTaskQueue("read-project-config")), readProjectConfigTask) 173 r.POST("/internal/tasks/read-project-config", base.Extend(gaemiddleware. RequireTaskQueue("read-project-config")), readProjectConfigTask)
174 r.POST("/internal/tasks/timers", base.Extend(gaemiddleware.RequireTaskQu eue("timers")), actionTask) 174 r.POST("/internal/tasks/timers", base.Extend(gaemiddleware.RequireTaskQu eue("timers")), actionTask)
175 r.POST("/internal/tasks/invocations", base.Extend(gaemiddleware.RequireT askQueue("invocations")), actionTask) 175 r.POST("/internal/tasks/invocations", base.Extend(gaemiddleware.RequireT askQueue("invocations")), actionTask)
176 176
177 // Devserver can't accept PubSub pushes, so allow manual pulls instead t o 177 // Devserver can't accept PubSub pushes, so allow manual pulls instead t o
178 // simplify local development. 178 // simplify local development.
179 if appengine.IsDevAppServer() { 179 if appengine.IsDevAppServer() {
180 r.GET("/pubsub/pull/:ManagerName/:Publisher", base, pubsubPullHa ndler) 180 r.GET("/pubsub/pull/:ManagerName/:Publisher", base, pubsubPullHa ndler)
181 } 181 }
182 182
183 // Install RPC servers. 183 // Install RPC servers.
184 api := prpc.Server{ 184 api := prpc.Server{
185 UnaryServerInterceptor: grpcmon.NewUnaryServerInterceptor(nil), 185 UnaryServerInterceptor: grpcmon.NewUnaryServerInterceptor(nil),
186 } 186 }
187 scheduler.RegisterSchedulerServer(&api, apiservers.SchedulerServer{ 187 scheduler.RegisterSchedulerServer(&api, apiservers.SchedulerServer{
188 » » Engine: globalEngine, 188 » » Engine: globalEngine.PublicAPI(),
189 Catalog: globalCatalog, 189 Catalog: globalCatalog,
190 }) 190 })
191 discovery.Enable(&api) 191 discovery.Enable(&api)
192 api.InstallHandlers(r, base) 192 api.InstallHandlers(r, base)
193 193
194 http.DefaultServeMux.Handle("/", r) 194 http.DefaultServeMux.Handle("/", r)
195 } 195 }
196 196
197 // pubsubPushHandler handles incoming PubSub messages. 197 // pubsubPushHandler handles incoming PubSub messages.
198 func pubsubPushHandler(c *router.Context) { 198 func pubsubPushHandler(c *router.Context) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 return 302 return
303 } 303 }
304 count, _ := strconv.Atoi(rc.Request.Header.Get("X-AppEngine-TaskExecutio nCount")) 304 count, _ := strconv.Atoi(rc.Request.Header.Get("X-AppEngine-TaskExecutio nCount"))
305 err = globalEngine.ExecuteSerializedAction(rc.Context, body, count) 305 err = globalEngine.ExecuteSerializedAction(rc.Context, body, count)
306 if err != nil { 306 if err != nil {
307 rc.err(err, "Error when executing the action") 307 rc.err(err, "Error when executing the action")
308 return 308 return
309 } 309 }
310 rc.ok() 310 rc.ok()
311 } 311 }
OLDNEW
« no previous file with comments | « scheduler/appengine/engine/engine_test.go ('k') | scheduler/appengine/messages/cron.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698