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

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

Issue 2364653002: Buildbot build json grpc endpoint (Closed)
Patch Set: Pass tests Created 4 years, 3 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/build_test.go ('k') | milo/appengine/buildbot/html.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/buildbot/grpc.go
diff --git a/milo/appengine/buildbot/grpc.go b/milo/appengine/buildbot/grpc.go
index 352f640a4d2bc4fb50b0a40f98a2a6a3d4ace433..3a07d879e262a8aaf35d8fc4f4e63d8dd89e08b8 100644
--- a/milo/appengine/buildbot/grpc.go
+++ b/milo/appengine/buildbot/grpc.go
@@ -25,6 +25,34 @@ type Service struct{}
var errNotFoundGRPC = grpc.Errorf(codes.NotFound, "Master Not Found")
+func (s *Service) GetBuildbotBuildJSON(
+ c context.Context, req *milo.BuildbotBuildRequest) (
+ *milo.BuildbotBuildJSON, error) {
+
+ if req.Master == "" {
+ return nil, grpc.Errorf(codes.InvalidArgument, "No master specified")
+ }
+ if req.Builder == "" {
+ return nil, grpc.Errorf(codes.InvalidArgument, "No builder specified")
+ }
+
+ b, err := build(c, req.Master, req.Builder, int(req.BuildNum))
+ switch {
+ case err == errBuildNotFound:
+ return nil, grpc.Errorf(codes.NotFound, "Build not found")
+ case err != nil:
+ return nil, err
+ }
+
+ bs, err := json.Marshal(b)
+ if err != nil {
+ return nil, err
+ }
+
+ // Marshal the build back into JSON format.
+ return &milo.BuildbotBuildJSON{Data: bs}, nil
+}
+
// GetCompressedMasterJSON assembles a CompressedMasterJSON object from the
// provided MasterRequest.
func (s *Service) GetCompressedMasterJSON(
« no previous file with comments | « milo/appengine/buildbot/build_test.go ('k') | milo/appengine/buildbot/html.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698