| OLD | NEW |
| 1 // Copyright 2017 The LUCI Authors. All rights reserved. | 1 // Copyright 2017 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 "strconv" | 9 "strconv" |
| 10 "strings" | 10 "strings" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // 3) Fetches the LogDog annotation stream and resolves it into a Step. | 55 // 3) Fetches the LogDog annotation stream and resolves it into a Step. |
| 56 // 4) Merges some operational BuildBot build information into the Step. | 56 // 4) Merges some operational BuildBot build information into the Step. |
| 57 func (p *BuildInfoProvider) GetBuildInfo(c context.Context, req *milo.BuildInfoR
equest_BuildBot, | 57 func (p *BuildInfoProvider) GetBuildInfo(c context.Context, req *milo.BuildInfoR
equest_BuildBot, |
| 58 projectHint cfgtypes.ProjectName) (*milo.BuildInfoResponse, error) { | 58 projectHint cfgtypes.ProjectName) (*milo.BuildInfoResponse, error) { |
| 59 | 59 |
| 60 logging.Infof(c, "Loading build info for master %q, builder %q, build #%
d", | 60 logging.Infof(c, "Loading build info for master %q, builder %q, build #%
d", |
| 61 req.MasterName, req.BuilderName, req.BuildNumber) | 61 req.MasterName, req.BuilderName, req.BuildNumber) |
| 62 | 62 |
| 63 // Load the BuildBot build from datastore. | 63 // Load the BuildBot build from datastore. |
| 64 build, err := getBuild(c, req.MasterName, req.BuilderName, int(req.Build
Number)) | 64 build, err := getBuild(c, req.MasterName, req.BuilderName, int(req.Build
Number)) |
| 65 » if err != nil { | 65 » switch err { |
| 66 » » if err == errBuildNotFound { | 66 » case errBuildNotFound: |
| 67 » » » return nil, grpcutil.Errf(codes.NotFound, "Build #%d for
master %q, builder %q was not found", | 67 » » return nil, grpcutil.Errf(codes.NotFound, "Build #%d for master
%q, builder %q was not found", |
| 68 » » » » req.BuildNumber, req.MasterName, req.BuilderName
) | 68 » » » req.BuildNumber, req.MasterName, req.BuilderName) |
| 69 » » } | 69 » case errNotAuth: |
| 70 | 70 » » return nil, grpcutil.Unauthenticated |
| 71 » case nil: |
| 72 » » // continue |
| 73 » default: |
| 71 logging.WithError(err).Errorf(c, "Failed to load build info.") | 74 logging.WithError(err).Errorf(c, "Failed to load build info.") |
| 72 return nil, grpcutil.Internal | 75 return nil, grpcutil.Internal |
| 73 } | 76 } |
| 74 | 77 |
| 75 // Create a new LogDog client. | 78 // Create a new LogDog client. |
| 76 client, err := p.newLogdogClient(c) | 79 client, err := p.newLogdogClient(c) |
| 77 if err != nil { | 80 if err != nil { |
| 78 logging.WithError(err).Errorf(c, "Failed to create LogDog client
.") | 81 logging.WithError(err).Errorf(c, "Failed to create LogDog client
.") |
| 79 return nil, grpcutil.Internal | 82 return nil, grpcutil.Internal |
| 80 } | 83 } |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 allProps.Add(prop.Name) | 264 allProps.Add(prop.Name) |
| 262 | 265 |
| 263 step.Property = append(step.Property, &miloProto.Step_Property{ | 266 step.Property = append(step.Property, &miloProto.Step_Property{ |
| 264 Name: prop.Name, | 267 Name: prop.Name, |
| 265 Value: fmt.Sprintf("%v", prop.Value), | 268 Value: fmt.Sprintf("%v", prop.Value), |
| 266 }) | 269 }) |
| 267 } | 270 } |
| 268 | 271 |
| 269 return nil | 272 return nil |
| 270 } | 273 } |
| OLD | NEW |