| 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 "crypto/sha1" | 8 "crypto/sha1" |
| 9 "encoding/base64" | 9 "encoding/base64" |
| 10 "errors" | 10 "errors" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // buildbot builder is specified. | 231 // buildbot builder is specified. |
| 232 keys := make([]string, 0, len(master.Builders)) | 232 keys := make([]string, 0, len(master.Builders)) |
| 233 for k := range master.Builders { | 233 for k := range master.Builders { |
| 234 keys = append(keys, k) | 234 keys = append(keys, k) |
| 235 } | 235 } |
| 236 sort.Strings(keys) | 236 sort.Strings(keys) |
| 237 return nil, errBuilderNotFound{masterName, builderName, keys} | 237 return nil, errBuilderNotFound{masterName, builderName, keys} |
| 238 } | 238 } |
| 239 // Extract pending builds out of the master json. | 239 // Extract pending builds out of the master json. |
| 240 result.PendingBuilds = make([]*resp.BuildSummary, len(p.PendingBuildStat
es)) | 240 result.PendingBuilds = make([]*resp.BuildSummary, len(p.PendingBuildStat
es)) |
| 241 result.PendingBuildNum = p.PendingBuilds |
| 241 logging.Debugf(c, "Number of pending builds: %d", len(p.PendingBuildStat
es)) | 242 logging.Debugf(c, "Number of pending builds: %d", len(p.PendingBuildStat
es)) |
| 242 for i, pb := range p.PendingBuildStates { | 243 for i, pb := range p.PendingBuildStates { |
| 243 start := time.Unix(int64(pb.SubmittedAt), 0).UTC() | 244 start := time.Unix(int64(pb.SubmittedAt), 0).UTC() |
| 244 result.PendingBuilds[i] = &resp.BuildSummary{ | 245 result.PendingBuilds[i] = &resp.BuildSummary{ |
| 245 PendingTime: resp.Interval{ | 246 PendingTime: resp.Interval{ |
| 246 Started: start, | 247 Started: start, |
| 247 Duration: clock.Now(c).UTC().Sub(start), | 248 Duration: clock.Now(c).UTC().Sub(start), |
| 248 }, | 249 }, |
| 249 } | 250 } |
| 250 result.PendingBuilds[i].Blame = make([]*resp.Commit, len(pb.Sour
ce.Changes)) | 251 result.PendingBuilds[i].Blame = make([]*resp.Commit, len(pb.Sour
ce.Changes)) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 } | 290 } |
| 290 result.CurrentBuilds = currentBuilds | 291 result.CurrentBuilds = currentBuilds |
| 291 | 292 |
| 292 for _, fb := range finishedBuilds { | 293 for _, fb := range finishedBuilds { |
| 293 if fb != nil { | 294 if fb != nil { |
| 294 result.FinishedBuilds = append(result.FinishedBuilds, fb
) | 295 result.FinishedBuilds = append(result.FinishedBuilds, fb
) |
| 295 } | 296 } |
| 296 } | 297 } |
| 297 return result, nil | 298 return result, nil |
| 298 } | 299 } |
| OLD | NEW |