OLD | NEW |
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 "github.com/golang/protobuf/proto" | 10 "github.com/golang/protobuf/proto" |
11 "golang.org/x/net/context" | 11 "golang.org/x/net/context" |
12 | 12 |
13 "github.com/luci/luci-go/appengine/gaemiddleware" | 13 "github.com/luci/luci-go/appengine/gaemiddleware" |
14 "github.com/luci/luci-go/grpc/discovery" | 14 "github.com/luci/luci-go/grpc/discovery" |
15 "github.com/luci/luci-go/grpc/grpcmon" | 15 "github.com/luci/luci-go/grpc/grpcmon" |
16 "github.com/luci/luci-go/grpc/prpc" | 16 "github.com/luci/luci-go/grpc/prpc" |
17 milo "github.com/luci/luci-go/milo/api/proto" | 17 milo "github.com/luci/luci-go/milo/api/proto" |
18 "github.com/luci/luci-go/milo/appengine/buildbot" | |
19 "github.com/luci/luci-go/milo/appengine/buildbucket" | |
20 "github.com/luci/luci-go/milo/appengine/common" | 18 "github.com/luci/luci-go/milo/appengine/common" |
21 "github.com/luci/luci-go/milo/appengine/console" | 19 "github.com/luci/luci-go/milo/appengine/console" |
22 » "github.com/luci/luci-go/milo/appengine/logdog" | 20 » "github.com/luci/luci-go/milo/appengine/job_source/buildbot" |
| 21 » "github.com/luci/luci-go/milo/appengine/job_source/buildbucket" |
| 22 » "github.com/luci/luci-go/milo/appengine/job_source/raw_presentation" |
| 23 » "github.com/luci/luci-go/milo/appengine/job_source/swarming" |
23 "github.com/luci/luci-go/milo/appengine/rpc" | 24 "github.com/luci/luci-go/milo/appengine/rpc" |
24 "github.com/luci/luci-go/milo/appengine/swarming" | |
25 "github.com/luci/luci-go/server/router" | 25 "github.com/luci/luci-go/server/router" |
26 ) | 26 ) |
27 | 27 |
28 func emptyPrelude(c context.Context, methodName string, req proto.Message) (cont
ext.Context, error) { | 28 func emptyPrelude(c context.Context, methodName string, req proto.Message) (cont
ext.Context, error) { |
29 return c, nil | 29 return c, nil |
30 } | 30 } |
31 | 31 |
32 // Where it all begins!!! | 32 // Where it all begins!!! |
33 func init() { | 33 func init() { |
34 // Register plain ol' http handlers. | 34 // Register plain ol' http handlers. |
(...skipping 21 matching lines...) Expand all Loading... |
56 // Buildbucket | 56 // Buildbucket |
57 r.GET("/buildbucket/:bucket/:builder", basemw, buildbucket.BuilderHandle
r) | 57 r.GET("/buildbucket/:bucket/:builder", basemw, buildbucket.BuilderHandle
r) |
58 | 58 |
59 // Buildbot | 59 // Buildbot |
60 r.GET("/buildbot/:master/:builder/:build", basemw, buildbot.BuildHandler
) | 60 r.GET("/buildbot/:master/:builder/:build", basemw, buildbot.BuildHandler
) |
61 r.GET("/buildbot/:master/:builder/", basemw, buildbot.BuilderHandler) | 61 r.GET("/buildbot/:master/:builder/", basemw, buildbot.BuilderHandler) |
62 | 62 |
63 // LogDog Milo Annotation Streams. | 63 // LogDog Milo Annotation Streams. |
64 // This mimicks the `logdog://logdog_host/project/*path` url scheme seen
on | 64 // This mimicks the `logdog://logdog_host/project/*path` url scheme seen
on |
65 // swarming tasks. | 65 // swarming tasks. |
66 » r.GET("/raw/build/:logdog_host/:project/*path", basemw, logdog.BuildHand
ler) | 66 » r.GET("/raw/build/:logdog_host/:project/*path", basemw, raw_presentation
.BuildHandler) |
67 | 67 |
68 // PubSub subscription endpoints. | 68 // PubSub subscription endpoints. |
69 r.POST("/_ah/push-handlers/buildbot", basemw, buildbot.PubSubHandler) | 69 r.POST("/_ah/push-handlers/buildbot", basemw, buildbot.PubSubHandler) |
70 | 70 |
71 // pRPC style endpoints. | 71 // pRPC style endpoints. |
72 api := prpc.Server{ | 72 api := prpc.Server{ |
73 UnaryServerInterceptor: grpcmon.NewUnaryServerInterceptor(nil), | 73 UnaryServerInterceptor: grpcmon.NewUnaryServerInterceptor(nil), |
74 } | 74 } |
75 milo.RegisterBuildbotServer(&api, &milo.DecoratedBuildbot{ | 75 milo.RegisterBuildbotServer(&api, &milo.DecoratedBuildbot{ |
76 Service: &buildbot.Service{}, | 76 Service: &buildbot.Service{}, |
77 Prelude: emptyPrelude, | 77 Prelude: emptyPrelude, |
78 }) | 78 }) |
79 milo.RegisterBuildInfoServer(&api, &milo.DecoratedBuildInfo{ | 79 milo.RegisterBuildInfoServer(&api, &milo.DecoratedBuildInfo{ |
80 Service: &rpc.BuildInfoService{}, | 80 Service: &rpc.BuildInfoService{}, |
81 Prelude: emptyPrelude, | 81 Prelude: emptyPrelude, |
82 }) | 82 }) |
83 discovery.Enable(&api) | 83 discovery.Enable(&api) |
84 api.InstallHandlers(r, gaemiddleware.BaseProd()) | 84 api.InstallHandlers(r, gaemiddleware.BaseProd()) |
85 | 85 |
86 http.DefaultServeMux.Handle("/", r) | 86 http.DefaultServeMux.Handle("/", r) |
87 } | 87 } |
OLD | NEW |