| OLD | NEW |
| 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 "fmt" | 9 "fmt" |
| 10 "io/ioutil" | 10 "io/ioutil" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // getBanner fetches the banner information about the bot that the build | 115 // getBanner fetches the banner information about the bot that the build |
| 116 // ran on. This is best effort and: | 116 // ran on. This is best effort and: |
| 117 // * Will return an empty list of banners if the master is not found. | 117 // * Will return an empty list of banners if the master is not found. |
| 118 // * May return incorrect data if the platform of the slave of the same name | 118 // * May return incorrect data if the platform of the slave of the same name |
| 119 // was changed recently, and this build was older than before the slave | 119 // was changed recently, and this build was older than before the slave |
| 120 // changed platforms. | 120 // changed platforms. |
| 121 func getBanner(c context.Context, b *buildbotBuild, m *buildbotMaster) *resp.Log
oBanner { | 121 func getBanner(c context.Context, b *buildbotBuild, m *buildbotMaster) *resp.Log
oBanner { |
| 122 logos := &resp.LogoBanner{} | 122 logos := &resp.LogoBanner{} |
| 123 // Fetch the master info from datastore if not provided. | 123 // Fetch the master info from datastore if not provided. |
| 124 if m == nil { | 124 if m == nil { |
| 125 » » m1, _, _, err := getMasterJSON(c, b.Master) | 125 » » m1, _, err := getMasterJSON(c, b.Master) |
| 126 m = m1 | 126 m = m1 |
| 127 if err != nil { | 127 if err != nil { |
| 128 logging.Warningf(c, "Failed to fetch master information
for banners on master %s", b.Master) | 128 logging.Warningf(c, "Failed to fetch master information
for banners on master %s", b.Master) |
| 129 return nil | 129 return nil |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 | 132 |
| 133 s, ok := m.Slaves[b.Slave] | 133 s, ok := m.Slaves[b.Slave] |
| 134 if !ok { | 134 if !ok { |
| 135 logging.Warningf(c, "Could not find slave %s in master %s", b.Sl
ave, b.Master) | 135 logging.Warningf(c, "Could not find slave %s in master %s", b.Sl
ave, b.Master) |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 | 476 |
| 477 // TODO(hinoka): Do all fields concurrently. | 477 // TODO(hinoka): Do all fields concurrently. |
| 478 return &resp.MiloBuild{ | 478 return &resp.MiloBuild{ |
| 479 SourceStamp: sourcestamp(c, b), | 479 SourceStamp: sourcestamp(c, b), |
| 480 Summary: summary(c, b), | 480 Summary: summary(c, b), |
| 481 Components: components(b), | 481 Components: components(b), |
| 482 PropertyGroup: properties(b), | 482 PropertyGroup: properties(b), |
| 483 Blame: blame(b), | 483 Blame: blame(b), |
| 484 }, nil | 484 }, nil |
| 485 } | 485 } |
| OLD | NEW |