| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 }() | 107 }() |
| 108 if osLogo != nil { | 108 if osLogo != nil { |
| 109 return &resp.LogoBanner{ | 109 return &resp.LogoBanner{ |
| 110 OS: []resp.Logo{*osLogo}, | 110 OS: []resp.Logo{*osLogo}, |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 logging.Warningf(c, "No OS info found.") | 113 logging.Warningf(c, "No OS info found.") |
| 114 return nil | 114 return nil |
| 115 } | 115 } |
| 116 | 116 |
| 117 // summary Extract the top level summary from a buildbot build as a | 117 // summary extracts the top level summary from a buildbot build as a |
| 118 // BuildComponent | 118 // BuildComponent |
| 119 func summary(c context.Context, b *buildbotBuild) resp.BuildComponent { | 119 func summary(c context.Context, b *buildbotBuild) resp.BuildComponent { |
| 120 // TODO(hinoka): use b.toStatus() | 120 // TODO(hinoka): use b.toStatus() |
| 121 // Status | 121 // Status |
| 122 var status resp.Status | 122 var status resp.Status |
| 123 if b.Currentstep != nil { | 123 if b.Currentstep != nil { |
| 124 status = resp.Running | 124 status = resp.Running |
| 125 } else { | 125 } else { |
| 126 status = result2Status(b.Results) | 126 status = result2Status(b.Results) |
| 127 } | 127 } |
| 128 | 128 |
| 129 // Timing info | 129 // Timing info |
| 130 started, ended, duration := parseTimes(b.Times) | 130 started, ended, duration := parseTimes(b.Times) |
| 131 | 131 |
| 132 // Link to bot and original build. | 132 // Link to bot and original build. |
| 133 server := "build.chromium.org/p" | 133 server := "build.chromium.org/p" |
| 134 if b.Internal { | 134 if b.Internal { |
| 135 server = "uberchromegw.corp.google.com/i" | 135 server = "uberchromegw.corp.google.com/i" |
| 136 } | 136 } |
| 137 bot := &resp.Link{ | 137 bot := &resp.Link{ |
| 138 Label: b.Slave, | 138 Label: b.Slave, |
| 139 URL: fmt.Sprintf("https://%s/%s/buildslaves/%s", server, b.Mas
ter, b.Slave), | 139 URL: fmt.Sprintf("https://%s/%s/buildslaves/%s", server, b.Mas
ter, b.Slave), |
| 140 } | 140 } |
| 141 host := "build.chromium.org/p" | 141 host := "build.chromium.org/p" |
| 142 if b.Internal { | 142 if b.Internal { |
| 143 host = "uberchromegw.corp.google.com/i" | 143 host = "uberchromegw.corp.google.com/i" |
| 144 } | 144 } |
| 145 source := &resp.Link{ | 145 source := &resp.Link{ |
| 146 Label: fmt.Sprintf("%s/%s/%d", b.Master, b.Buildername, b.Number
), | 146 Label: fmt.Sprintf("%s/%s/%d", b.Master, b.Buildername, b.Number
), |
| 147 // TODO(hinoka): Internal builds. | |
| 148 URL: fmt.Sprintf( | 147 URL: fmt.Sprintf( |
| 149 "https://%s/%s/builders/%s/builds/%d", | 148 "https://%s/%s/builders/%s/builds/%d", |
| 150 host, b.Master, b.Buildername, b.Number), | 149 host, b.Master, b.Buildername, b.Number), |
| 151 } | 150 } |
| 152 | 151 |
| 153 // The link to the builder page. | 152 // The link to the builder page. |
| 154 parent := &resp.Link{ | 153 parent := &resp.Link{ |
| 155 Label: b.Buildername, | 154 Label: b.Buildername, |
| 156 URL: ".", | 155 URL: ".", |
| 157 } | 156 } |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 var newAliases map[string][]*buildbotLinkAlias | 643 var newAliases map[string][]*buildbotLinkAlias |
| 645 if l := remainingAliases.Len(); l > 0 { | 644 if l := remainingAliases.Len(); l > 0 { |
| 646 newAliases = make(map[string][]*buildbotLinkAlias, l) | 645 newAliases = make(map[string][]*buildbotLinkAlias, l) |
| 647 remainingAliases.Iter(func(v string) bool { | 646 remainingAliases.Iter(func(v string) bool { |
| 648 newAliases[v] = s.Aliases[v] | 647 newAliases[v] = s.Aliases[v] |
| 649 return true | 648 return true |
| 650 }) | 649 }) |
| 651 } | 650 } |
| 652 s.Aliases = newAliases | 651 s.Aliases = newAliases |
| 653 } | 652 } |
| OLD | NEW |