| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 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 buildbot | 5 package buildbot |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "bytes" | 8 "bytes" |
| 9 "compress/gzip" | 9 "compress/gzip" |
| 10 "encoding/json" | 10 "encoding/json" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 c context.Context, req *milo.BuildbotBuildRequest) ( | 29 c context.Context, req *milo.BuildbotBuildRequest) ( |
| 30 *milo.BuildbotBuildJSON, error) { | 30 *milo.BuildbotBuildJSON, error) { |
| 31 | 31 |
| 32 if req.Master == "" { | 32 if req.Master == "" { |
| 33 return nil, grpc.Errorf(codes.InvalidArgument, "No master specif
ied") | 33 return nil, grpc.Errorf(codes.InvalidArgument, "No master specif
ied") |
| 34 } | 34 } |
| 35 if req.Builder == "" { | 35 if req.Builder == "" { |
| 36 return nil, grpc.Errorf(codes.InvalidArgument, "No builder speci
fied") | 36 return nil, grpc.Errorf(codes.InvalidArgument, "No builder speci
fied") |
| 37 } | 37 } |
| 38 | 38 |
| 39 » b, err := build(c, req.Master, req.Builder, int(req.BuildNum)) | 39 » b, err := getBuild(c, req.Master, req.Builder, int(req.BuildNum)) |
| 40 switch { | 40 switch { |
| 41 case err == errBuildNotFound: | 41 case err == errBuildNotFound: |
| 42 return nil, grpc.Errorf(codes.NotFound, "Build not found") | 42 return nil, grpc.Errorf(codes.NotFound, "Build not found") |
| 43 case err != nil: | 43 case err != nil: |
| 44 return nil, err | 44 return nil, err |
| 45 } | 45 } |
| 46 | 46 |
| 47 bs, err := json.Marshal(b) | 47 bs, err := json.Marshal(b) |
| 48 if err != nil { | 48 if err != nil { |
| 49 return nil, err | 49 return nil, err |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 return &milo.CompressedMasterJSON{ | 136 return &milo.CompressedMasterJSON{ |
| 137 Internal: entry.Internal, | 137 Internal: entry.Internal, |
| 138 Modified: &google.Timestamp{ | 138 Modified: &google.Timestamp{ |
| 139 Seconds: entry.Modified.Unix(), | 139 Seconds: entry.Modified.Unix(), |
| 140 Nanos: int32(entry.Modified.Nanosecond()), | 140 Nanos: int32(entry.Modified.Nanosecond()), |
| 141 }, | 141 }, |
| 142 Data: gzbs.Bytes(), | 142 Data: gzbs.Bytes(), |
| 143 }, nil | 143 }, nil |
| 144 } | 144 } |
| OLD | NEW |