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

Side by Side Diff: milo/appengine/buildbot/html.go

Issue 2364653002: Buildbot build json grpc endpoint (Closed)
Patch Set: Pass tests Created 4 years, 2 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 | « milo/appengine/buildbot/grpc.go ('k') | milo/appengine/buildbot/html_data.go » ('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. 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 buildbot 5 package buildbot
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "net/http" 9 "net/http"
10 "os" 10 "os"
11 "strconv"
11 12
12 "github.com/julienschmidt/httprouter" 13 "github.com/julienschmidt/httprouter"
13 "golang.org/x/net/context" 14 "golang.org/x/net/context"
14 15
15 "github.com/luci/luci-go/milo/appengine/settings" 16 "github.com/luci/luci-go/milo/appengine/settings"
16 "github.com/luci/luci-go/milo/common/miloerror" 17 "github.com/luci/luci-go/milo/common/miloerror"
17 "github.com/luci/luci-go/server/templates" 18 "github.com/luci/luci-go/server/templates"
18 ) 19 )
19 20
20 // Build is the container struct for methods related to buildbot build pages. 21 // Build is the container struct for methods related to buildbot build pages.
(...skipping 23 matching lines...) Expand all
44 Code: http.StatusBadRequest, 45 Code: http.StatusBadRequest,
45 } 46 }
46 } 47 }
47 buildNum := p.ByName("build") 48 buildNum := p.ByName("build")
48 if buildNum == "" { 49 if buildNum == "" {
49 return nil, &miloerror.Error{ 50 return nil, &miloerror.Error{
50 Message: "No build num", 51 Message: "No build num",
51 Code: http.StatusBadRequest, 52 Code: http.StatusBadRequest,
52 } 53 }
53 } 54 }
55 num, err := strconv.Atoi(buildNum)
56 if err != nil {
57 return nil, &miloerror.Error{
58 Message: fmt.Sprintf("%s does not look like a number", b uildNum),
59 Code: http.StatusBadRequest,
60 }
61 }
54 62
55 » result, err := build(c, master, builder, buildNum) 63 » result, err := build(c, master, builder, num)
56 if err != nil { 64 if err != nil {
57 return nil, err 65 return nil, err
58 } 66 }
59 67
60 // Render into the template 68 // Render into the template
61 fmt.Fprintf(os.Stderr, "Result: %#v\n\n", result) 69 fmt.Fprintf(os.Stderr, "Result: %#v\n\n", result)
62 args := &templates.Args{ 70 args := &templates.Args{
63 "Build": result, 71 "Build": result,
64 } 72 }
65 return args, nil 73 return args, nil
(...skipping 25 matching lines...) Expand all
91 if err != nil { 99 if err != nil {
92 return nil, err 100 return nil, err
93 } 101 }
94 102
95 // Render into the template 103 // Render into the template
96 args := &templates.Args{ 104 args := &templates.Args{
97 "Builder": result, 105 "Builder": result,
98 } 106 }
99 return args, nil 107 return args, nil
100 } 108 }
OLDNEW
« no previous file with comments | « milo/appengine/buildbot/grpc.go ('k') | milo/appengine/buildbot/html_data.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698