OLD | NEW |
1 // Copyright 2017 The LUCI Authors. All rights reserved. | 1 // Copyright 2017 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 buildbucket | 5 package buildbucket |
6 | 6 |
7 import ( | 7 import ( |
8 "errors" | 8 "errors" |
9 "fmt" | 9 "fmt" |
10 | 10 |
11 "golang.org/x/net/context" | 11 "golang.org/x/net/context" |
12 | 12 |
13 "github.com/luci/luci-go/milo/api/resp" | 13 "github.com/luci/luci-go/milo/api/resp" |
14 » "github.com/luci/luci-go/milo/appengine/common" | 14 » "github.com/luci/luci-go/milo/common" |
15 ) | 15 ) |
16 | 16 |
17 func GetAllBuilders(c context.Context) (*resp.CIService, error) { | 17 func GetAllBuilders(c context.Context) (*resp.CIService, error) { |
18 settings := common.GetSettings(c) | 18 settings := common.GetSettings(c) |
19 bucketSettings := settings.Buildbucket | 19 bucketSettings := settings.Buildbucket |
20 if bucketSettings == nil { | 20 if bucketSettings == nil { |
21 return nil, errors.New("buildbucket settings missing in config") | 21 return nil, errors.New("buildbucket settings missing in config") |
22 } | 22 } |
23 result := &resp.CIService{ | 23 result := &resp.CIService{ |
24 Name: "Swarmbucket", | 24 Name: "Swarmbucket", |
(...skipping 15 matching lines...) Expand all Loading... |
40 group.Builders = make([]resp.Link, len(bucket.Builders)) | 40 group.Builders = make([]resp.Link, len(bucket.Builders)) |
41 for j, builder := range bucket.Builders { | 41 for j, builder := range bucket.Builders { |
42 group.Builders[j] = *resp.NewLink( | 42 group.Builders[j] = *resp.NewLink( |
43 builder.Name, fmt.Sprintf("/buildbucket/%s/%s",
bucket.Name, builder.Name)) | 43 builder.Name, fmt.Sprintf("/buildbucket/%s/%s",
bucket.Name, builder.Name)) |
44 } | 44 } |
45 result.BuilderGroups[i] = group | 45 result.BuilderGroups[i] = group |
46 } | 46 } |
47 | 47 |
48 return result, nil | 48 return result, nil |
49 } | 49 } |
OLD | NEW |