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

Side by Side Diff: milo/buildsource/buildbot/buildinfo.go

Issue 2977863002: [milo] Refactor all html knowledge out of backends. (Closed)
Patch Set: now with case insensitivity Created 3 years, 5 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/buildsource/buildbot/builder_test.go ('k') | milo/buildsource/buildbot/datastore.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 2017 The LUCI Authors. 1 // Copyright 2017 The LUCI Authors.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 11 matching lines...) Expand all
22 22
23 "github.com/luci/luci-go/common/data/stringset" 23 "github.com/luci/luci-go/common/data/stringset"
24 "github.com/luci/luci-go/common/logging" 24 "github.com/luci/luci-go/common/logging"
25 miloProto "github.com/luci/luci-go/common/proto/milo" 25 miloProto "github.com/luci/luci-go/common/proto/milo"
26 "github.com/luci/luci-go/grpc/grpcutil" 26 "github.com/luci/luci-go/grpc/grpcutil"
27 "github.com/luci/luci-go/logdog/client/coordinator" 27 "github.com/luci/luci-go/logdog/client/coordinator"
28 "github.com/luci/luci-go/logdog/common/types" 28 "github.com/luci/luci-go/logdog/common/types"
29 "github.com/luci/luci-go/luci_config/common/cfgtypes" 29 "github.com/luci/luci-go/luci_config/common/cfgtypes"
30 milo "github.com/luci/luci-go/milo/api/proto" 30 milo "github.com/luci/luci-go/milo/api/proto"
31 "github.com/luci/luci-go/milo/buildsource/rawpresentation" 31 "github.com/luci/luci-go/milo/buildsource/rawpresentation"
32 "github.com/luci/luci-go/milo/common"
32 33
33 "google.golang.org/grpc/codes" 34 "google.golang.org/grpc/codes"
34 35
35 "golang.org/x/net/context" 36 "golang.org/x/net/context"
36 ) 37 )
37 38
38 // BuildInfoProvider is a configuration that provides build information. 39 // BuildInfoProvider is a configuration that provides build information.
39 // 40 //
40 // In a production system, this will be completely defaults. For testing, the 41 // In a production system, this will be completely defaults. For testing, the
41 // various services and data sources may be substituted for testing stubs. 42 // various services and data sources may be substituted for testing stubs.
(...skipping 23 matching lines...) Expand all
65 // 3) Fetches the LogDog annotation stream and resolves it into a Step. 66 // 3) Fetches the LogDog annotation stream and resolves it into a Step.
66 // 4) Merges some operational BuildBot build information into the Step. 67 // 4) Merges some operational BuildBot build information into the Step.
67 func (p *BuildInfoProvider) GetBuildInfo(c context.Context, req *milo.BuildInfoR equest_BuildBot, 68 func (p *BuildInfoProvider) GetBuildInfo(c context.Context, req *milo.BuildInfoR equest_BuildBot,
68 projectHint cfgtypes.ProjectName) (*milo.BuildInfoResponse, error) { 69 projectHint cfgtypes.ProjectName) (*milo.BuildInfoResponse, error) {
69 70
70 logging.Infof(c, "Loading build info for master %q, builder %q, build #% d", 71 logging.Infof(c, "Loading build info for master %q, builder %q, build #% d",
71 req.MasterName, req.BuilderName, req.BuildNumber) 72 req.MasterName, req.BuilderName, req.BuildNumber)
72 73
73 // Load the BuildBot build from datastore. 74 // Load the BuildBot build from datastore.
74 build, err := getBuild(c, req.MasterName, req.BuilderName, int(req.Build Number)) 75 build, err := getBuild(c, req.MasterName, req.BuilderName, int(req.Build Number))
75 » switch err { 76 » if err != nil {
76 » case errBuildNotFound: 77 » » switch common.ErrorTag.In(err) {
77 » » return nil, grpcutil.Errf(codes.NotFound, "Build #%d for master %q, builder %q was not found", 78 » » case common.CodeNotFound:
78 » » » req.BuildNumber, req.MasterName, req.BuilderName) 79 » » » return nil, grpcutil.Errf(codes.NotFound, "Build #%d for master %q, builder %q was not found",
79 » case errNotAuth: 80 » » » » req.BuildNumber, req.MasterName, req.BuilderName )
80 » » return nil, grpcutil.Unauthenticated 81
81 » case nil: 82 » » case common.CodeUnauthorized:
82 » » // continue 83 » » » return nil, grpcutil.Unauthenticated
83 » default: 84
84 » » logging.WithError(err).Errorf(c, "Failed to load build info.") 85 » » default:
85 » » return nil, grpcutil.Internal 86 » » » logging.WithError(err).Errorf(c, "Failed to load build i nfo.")
87 » » » return nil, grpcutil.Internal
88 » » }
86 } 89 }
87 90
88 // Create a new LogDog client. 91 // Create a new LogDog client.
89 client, err := p.newLogdogClient(c) 92 client, err := p.newLogdogClient(c)
90 if err != nil { 93 if err != nil {
91 logging.WithError(err).Errorf(c, "Failed to create LogDog client .") 94 logging.WithError(err).Errorf(c, "Failed to create LogDog client .")
92 return nil, grpcutil.Internal 95 return nil, grpcutil.Internal
93 } 96 }
94 97
95 // Identify the LogDog annotation stream from the build. 98 // Identify the LogDog annotation stream from the build.
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 allProps.Add(prop.Name) 277 allProps.Add(prop.Name)
275 278
276 step.Property = append(step.Property, &miloProto.Step_Property{ 279 step.Property = append(step.Property, &miloProto.Step_Property{
277 Name: prop.Name, 280 Name: prop.Name,
278 Value: fmt.Sprintf("%v", prop.Value), 281 Value: fmt.Sprintf("%v", prop.Value),
279 }) 282 })
280 } 283 }
281 284
282 return nil 285 return nil
283 } 286 }
OLDNEW
« no previous file with comments | « milo/buildsource/buildbot/builder_test.go ('k') | milo/buildsource/buildbot/datastore.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698