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