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

Unified Diff: milo/appengine/buildbot/build.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/api/proto/pb.discovery.go ('k') | milo/appengine/buildbot/build_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/buildbot/build.go
diff --git a/milo/appengine/buildbot/build.go b/milo/appengine/buildbot/build.go
index fa1ac238d7a41b9863074fa20c38fa7f79d1a2f1..844edffdcf9279ac095465c3f26455aac455790c 100644
--- a/milo/appengine/buildbot/build.go
+++ b/milo/appengine/buildbot/build.go
@@ -11,7 +11,6 @@ import (
"net/http"
"path/filepath"
"sort"
- "strconv"
"strings"
"time"
@@ -29,22 +28,14 @@ var errBuildNotFound = miloerror.Error{
}
// getBuild fetches a buildbot build from the datastore and checks ACLs.
-func getBuild(c context.Context, master, builder, buildNum string) (*buildbotBuild, error) {
+func getBuild(c context.Context, master, builder string, buildNum int) (*buildbotBuild, error) {
result := &buildbotBuild{
Master: master,
Buildername: builder,
+ Number: buildNum,
}
- num, err := strconv.Atoi(buildNum)
- if err != nil {
- return nil, miloerror.Error{
- Message: fmt.Sprintf("%s does not look like a number", buildNum),
- Code: http.StatusBadRequest,
- }
- }
- result.Number = num
-
- err = ds.Get(c, result)
+ err := ds.Get(c, result)
switch {
case err == ds.ErrNoSuchEntity:
return nil, errBuildNotFound
@@ -408,8 +399,8 @@ func sourcestamp(c context.Context, b *buildbotBuild) *resp.SourceStamp {
return ss
}
-func getDebugBuild(c context.Context, builder, buildNum string) (*buildbotBuild, error) {
- fname := fmt.Sprintf("%s.%s.json", builder, buildNum)
+func getDebugBuild(c context.Context, builder string, buildNum int) (*buildbotBuild, error) {
+ fname := fmt.Sprintf("%s.%d.json", builder, buildNum)
// ../buildbot below assumes that
// - this code is not executed by tests outside of this dir
// - this dir is a sibling of frontend dir
@@ -423,7 +414,7 @@ func getDebugBuild(c context.Context, builder, buildNum string) (*buildbotBuild,
}
// build fetches a buildbot build and translates it into a miloBuild.
-func build(c context.Context, master, builder, buildNum string) (*resp.MiloBuild, error) {
+func build(c context.Context, master, builder string, buildNum int) (*resp.MiloBuild, error) {
var b *buildbotBuild
var err error
if master == "debug" {
« no previous file with comments | « milo/api/proto/pb.discovery.go ('k') | milo/appengine/buildbot/build_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698