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

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

Issue 2748073006: Milo Refactor: Remove theme support (Closed)
Patch Set: Fix builder.html pointer Created 3 years, 9 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
OLDNEW
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 "encoding/json" 8 "encoding/json"
9 "errors"
9 "fmt" 10 "fmt"
10 "io/ioutil" 11 "io/ioutil"
11 "net/http"
12 "path/filepath" 12 "path/filepath"
13 "regexp" 13 "regexp"
14 "sort" 14 "sort"
15 "strings" 15 "strings"
16 "time" 16 "time"
17 17
18 "golang.org/x/net/context"
19
20 "github.com/luci/gae/service/datastore"
18 "github.com/luci/luci-go/common/data/stringset" 21 "github.com/luci/luci-go/common/data/stringset"
19 "github.com/luci/luci-go/common/logging" 22 "github.com/luci/luci-go/common/logging"
20 "github.com/luci/luci-go/milo/api/resp" 23 "github.com/luci/luci-go/milo/api/resp"
21 "github.com/luci/luci-go/milo/common/miloerror"
22
23 ds "github.com/luci/gae/service/datastore"
24
25 "golang.org/x/net/context"
26 ) 24 )
27 25
28 var errBuildNotFound = miloerror.Error{ 26 var errBuildNotFound = errors.New("Build not found")
nodir 2017/03/20 19:11:36 error messages in Go should start with a non-capit
hinoka 2017/03/20 19:16:31 Acknowledged.
29 » Message: "Build not found",
30 » Code: http.StatusNotFound,
31 }
32 27
33 // getBuild fetches a buildbot build from the datastore and checks ACLs. 28 // getBuild fetches a buildbot build from the datastore and checks ACLs.
34 // The return code matches the master responses. 29 // The return code matches the master responses.
35 func getBuild(c context.Context, master, builder string, buildNum int) (*buildbo tBuild, error) { 30 func getBuild(c context.Context, master, builder string, buildNum int) (*buildbo tBuild, error) {
36 result := &buildbotBuild{ 31 result := &buildbotBuild{
37 Master: master, 32 Master: master,
38 Buildername: builder, 33 Buildername: builder,
39 Number: buildNum, 34 Number: buildNum,
40 } 35 }
41 36
42 » err := ds.Get(c, result) 37 » err := datastore.Get(c, result)
43 err = checkAccess(c, err, result.Internal) 38 err = checkAccess(c, err, result.Internal)
44 if err == errMasterNotFound { 39 if err == errMasterNotFound {
45 err = errBuildNotFound 40 err = errBuildNotFound
46 } 41 }
47 return result, err 42 return result, err
48 } 43 }
49 44
50 // result2Status translates a buildbot result integer into a resp.Status. 45 // result2Status translates a buildbot result integer into a resp.Status.
51 func result2Status(s *int) (status resp.Status) { 46 func result2Status(s *int) (status resp.Status) {
52 if s == nil { 47 if s == nil {
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 524
530 // TODO(hinoka): Do all fields concurrently. 525 // TODO(hinoka): Do all fields concurrently.
531 return &resp.MiloBuild{ 526 return &resp.MiloBuild{
532 SourceStamp: sourcestamp(c, b), 527 SourceStamp: sourcestamp(c, b),
533 Summary: summary(c, b), 528 Summary: summary(c, b),
534 Components: components(b), 529 Components: components(b),
535 PropertyGroup: properties(b), 530 PropertyGroup: properties(b),
536 Blame: blame(b), 531 Blame: blame(b),
537 }, nil 532 }, nil
538 } 533 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698