| 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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 path := filepath.Join("..", "buildbot", "testdata", fname) | 473 path := filepath.Join("..", "buildbot", "testdata", fname) |
| 474 raw, err := ioutil.ReadFile(path) | 474 raw, err := ioutil.ReadFile(path) |
| 475 if err != nil { | 475 if err != nil { |
| 476 return nil, err | 476 return nil, err |
| 477 } | 477 } |
| 478 b := &buildbotBuild{} | 478 b := &buildbotBuild{} |
| 479 return b, json.Unmarshal(raw, b) | 479 return b, json.Unmarshal(raw, b) |
| 480 } | 480 } |
| 481 | 481 |
| 482 // build fetches a buildbot build and translates it into a miloBuild. | 482 // build fetches a buildbot build and translates it into a miloBuild. |
| 483 func build(c context.Context, master, builder string, buildNum int) (*resp.MiloB
uild, error) { | 483 func Build(c context.Context, master, builder string, buildNum int) (*resp.MiloB
uild, error) { |
| 484 var b *buildbotBuild | 484 var b *buildbotBuild |
| 485 var err error | 485 var err error |
| 486 if master == "debug" { | 486 if master == "debug" { |
| 487 b, err = getDebugBuild(c, builder, buildNum) | 487 b, err = getDebugBuild(c, builder, buildNum) |
| 488 } else { | 488 } else { |
| 489 b, err = getBuild(c, master, builder, buildNum) | 489 b, err = getBuild(c, master, builder, buildNum) |
| 490 } | 490 } |
| 491 if err != nil { | 491 if err != nil { |
| 492 return nil, err | 492 return nil, err |
| 493 } | 493 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 var newAliases map[string][]*buildbotLinkAlias | 643 var newAliases map[string][]*buildbotLinkAlias |
| 644 if l := remainingAliases.Len(); l > 0 { | 644 if l := remainingAliases.Len(); l > 0 { |
| 645 newAliases = make(map[string][]*buildbotLinkAlias, l) | 645 newAliases = make(map[string][]*buildbotLinkAlias, l) |
| 646 remainingAliases.Iter(func(v string) bool { | 646 remainingAliases.Iter(func(v string) bool { |
| 647 newAliases[v] = s.Aliases[v] | 647 newAliases[v] = s.Aliases[v] |
| 648 return true | 648 return true |
| 649 }) | 649 }) |
| 650 } | 650 } |
| 651 s.Aliases = newAliases | 651 s.Aliases = newAliases |
| 652 } | 652 } |
| OLD | NEW |