Chromium Code Reviews| 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 "errors" | 9 "errors" |
| 10 "fmt" | 10 "fmt" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 }() | 106 }() |
| 107 if osLogo != nil { | 107 if osLogo != nil { |
| 108 return &resp.LogoBanner{ | 108 return &resp.LogoBanner{ |
| 109 OS: []resp.Logo{*osLogo}, | 109 OS: []resp.Logo{*osLogo}, |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 logging.Warningf(c, "No OS info found.") | 112 logging.Warningf(c, "No OS info found.") |
| 113 return nil | 113 return nil |
| 114 } | 114 } |
| 115 | 115 |
| 116 // summary Extract the top level summary from a buildbot build as a | 116 // summary Extract the top level summary from a buildbot build as a |
|
nodir
2017/03/24 08:41:15
extracts
hinoka
2017/03/28 17:47:20
Done.
| |
| 117 // BuildComponent | 117 // BuildComponent |
| 118 func summary(c context.Context, b *buildbotBuild) resp.BuildComponent { | 118 func summary(c context.Context, b *buildbotBuild) resp.BuildComponent { |
| 119 // TODO(hinoka): use b.toStatus() | 119 // TODO(hinoka): use b.toStatus() |
| 120 // Status | 120 // Status |
| 121 var status resp.Status | 121 var status resp.Status |
| 122 if b.Currentstep != nil { | 122 if b.Currentstep != nil { |
| 123 status = resp.Running | 123 status = resp.Running |
| 124 } else { | 124 } else { |
| 125 status = result2Status(b.Results) | 125 status = result2Status(b.Results) |
| 126 } | 126 } |
| 127 | 127 |
| 128 // Timing info | 128 // Timing info |
| 129 started, ended, duration := parseTimes(b.Times) | 129 started, ended, duration := parseTimes(b.Times) |
| 130 | 130 |
| 131 // Link to bot and original build. | 131 // Link to bot and original build. |
| 132 server := "build.chromium.org/p" | 132 server := "build.chromium.org/p" |
| 133 if b.Internal { | 133 if b.Internal { |
| 134 server = "uberchromegw.corp.google.com/i" | 134 server = "uberchromegw.corp.google.com/i" |
| 135 } | 135 } |
| 136 bot := &resp.Link{ | 136 bot := &resp.Link{ |
| 137 Label: b.Slave, | 137 Label: b.Slave, |
| 138 URL: fmt.Sprintf("https://%s/%s/buildslaves/%s", server, b.Mas ter, b.Slave), | 138 URL: fmt.Sprintf("https://%s/%s/buildslaves/%s", server, b.Mas ter, b.Slave), |
| 139 } | 139 } |
| 140 host := "build.chromium.org/p" | 140 host := "build.chromium.org/p" |
| 141 if b.Internal { | 141 if b.Internal { |
| 142 host = "uberchromegw.corp.google.com/i" | 142 host = "uberchromegw.corp.google.com/i" |
| 143 } | 143 } |
| 144 source := &resp.Link{ | 144 source := &resp.Link{ |
| 145 Label: fmt.Sprintf("%s/%s/%d", b.Master, b.Buildername, b.Number ), | 145 Label: fmt.Sprintf("%s/%s/%d", b.Master, b.Buildername, b.Number ), |
| 146 // TODO(hinoka): Internal builds. | |
| 147 URL: fmt.Sprintf( | 146 URL: fmt.Sprintf( |
| 148 "https://%s/%s/builders/%s/builds/%d", | 147 "https://%s/%s/builders/%s/builds/%d", |
| 149 host, b.Master, b.Buildername, b.Number), | 148 host, b.Master, b.Buildername, b.Number), |
| 150 } | 149 } |
| 151 | 150 |
| 152 // The link to the builder page. | 151 // The link to the builder page. |
| 153 parent := &resp.Link{ | 152 parent := &resp.Link{ |
| 154 Label: b.Buildername, | 153 Label: b.Buildername, |
| 155 URL: ".", | 154 URL: ".", |
| 156 } | 155 } |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 524 | 523 |
| 525 // TODO(hinoka): Do all fields concurrently. | 524 // TODO(hinoka): Do all fields concurrently. |
| 526 return &resp.MiloBuild{ | 525 return &resp.MiloBuild{ |
| 527 SourceStamp: sourcestamp(c, b), | 526 SourceStamp: sourcestamp(c, b), |
| 528 Summary: summary(c, b), | 527 Summary: summary(c, b), |
| 529 Components: components(b), | 528 Components: components(b), |
| 530 PropertyGroup: properties(b), | 529 PropertyGroup: properties(b), |
| 531 Blame: blame(b), | 530 Blame: blame(b), |
| 532 }, nil | 531 }, nil |
| 533 } | 532 } |
| OLD | NEW |