| 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 "bytes" | 8 "bytes" |
| 9 "compress/gzip" | 9 "compress/gzip" |
| 10 "encoding/json" | 10 "encoding/json" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 Project string `json:"project"` | 327 Project string `json:"project"` |
| 328 Properties [][]interface{} `json:"properties"` | 328 Properties [][]interface{} `json:"properties"` |
| 329 Repository string `json:"repository"` | 329 Repository string `json:"repository"` |
| 330 Rev string `json:"rev"` | 330 Rev string `json:"rev"` |
| 331 Revision string `json:"revision"` | 331 Revision string `json:"revision"` |
| 332 Revlink string `json:"revlink"` | 332 Revlink string `json:"revlink"` |
| 333 When int `json:"when"` | 333 When int `json:"when"` |
| 334 Who string `json:"who"` | 334 Who string `json:"who"` |
| 335 } | 335 } |
| 336 | 336 |
| 337 func (bc *buildbotChange) GetFiles() []string { |
| 338 files := make([]string, 0, len(bc.Files)) |
| 339 for _, f := range bc.Files { |
| 340 // Buildbot stores files both as a string, or as a dict with a s
ingle entry |
| 341 // named "name". It doesn't matter to us what the type is, but
we need |
| 342 // to reflect on the type anyways. |
| 343 switch fn := f.(type) { |
| 344 case string: |
| 345 files = append(files, fn) |
| 346 case map[string]interface{}: |
| 347 if name, ok := fn["name"]; ok { |
| 348 files = append(files, fmt.Sprintf("%s", name)) |
| 349 } |
| 350 } |
| 351 } |
| 352 return files |
| 353 } |
| 354 |
| 337 // buildbotSlave describes a slave on a master from a master json, and also incl
udes the | 355 // buildbotSlave describes a slave on a master from a master json, and also incl
udes the |
| 338 // full builds of any currently running builds. | 356 // full builds of any currently running builds. |
| 339 type buildbotSlave struct { | 357 type buildbotSlave struct { |
| 340 // RecentBuilds is a map of builder name to a list of recent finished bu
ild | 358 // RecentBuilds is a map of builder name to a list of recent finished bu
ild |
| 341 // numbers on that builder. | 359 // numbers on that builder. |
| 342 RecentBuilds map[string][]int `json:"builders"` | 360 RecentBuilds map[string][]int `json:"builders"` |
| 343 Connected bool `json:"connected"` | 361 Connected bool `json:"connected"` |
| 344 Host string `json:"host"` | 362 Host string `json:"host"` |
| 345 Name string `json:"name"` | 363 Name string `json:"name"` |
| 346 Runningbuilds []*buildbotBuild `json:"runningBuilds"` | 364 Runningbuilds []*buildbotBuild `json:"runningBuilds"` |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 PendingBuilds int `json:"pending_builds"` | 432 PendingBuilds int `json:"pending_builds"` |
| 415 State string `json:"state"` | 433 State string `json:"state"` |
| 416 TotalSlaves int `json:"total_slaves"` | 434 TotalSlaves int `json:"total_slaves"` |
| 417 } `json:"builders"` | 435 } `json:"builders"` |
| 418 ServerUptime float64 `json:"server_uptime"` | 436 ServerUptime float64 `json:"server_uptime"` |
| 419 } `json:"varz"` | 437 } `json:"varz"` |
| 420 | 438 |
| 421 // This is injected by the pubsub publisher on the buildbot side. | 439 // This is injected by the pubsub publisher on the buildbot side. |
| 422 Name string `json:"name"` | 440 Name string `json:"name"` |
| 423 } | 441 } |
| OLD | NEW |