| 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/common/logging" | |
| 14 "github.com/luci/luci-go/milo/api/resp" | 13 "github.com/luci/luci-go/milo/api/resp" |
| 15 "github.com/luci/luci-go/milo/appengine/common" | 14 "github.com/luci/luci-go/milo/appengine/common" |
| 16 ) | 15 ) |
| 17 | 16 |
| 18 func GetAllBuilders(c context.Context) (*resp.CIService, error) { | 17 func GetAllBuilders(c context.Context) (*resp.CIService, error) { |
| 19 » settings, err := common.GetSettings(c) | 18 » settings := common.GetSettings(c) |
| 20 » if err != nil { | |
| 21 » » logging.WithError(err).Errorf(c, "could not get settings for bui
ldbucket") | |
| 22 » » return nil, err | |
| 23 » } | |
| 24 bucketSettings := settings.Buildbucket | 19 bucketSettings := settings.Buildbucket |
| 25 if bucketSettings == nil { | 20 if bucketSettings == nil { |
| 26 return nil, errors.New("buildbucket settings missing in config") | 21 return nil, errors.New("buildbucket settings missing in config") |
| 27 } | 22 } |
| 28 result := &resp.CIService{ | 23 result := &resp.CIService{ |
| 29 Name: "Swarmbucket", | 24 Name: "Swarmbucket", |
| 30 Host: &resp.Link{ | 25 Host: &resp.Link{ |
| 31 Label: bucketSettings.Name, | 26 Label: bucketSettings.Name, |
| 32 URL: "https://" + bucketSettings.Host, | 27 URL: "https://" + bucketSettings.Host, |
| 33 }, | 28 }, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 50 group.Builders[j] = resp.Link{ | 45 group.Builders[j] = resp.Link{ |
| 51 Label: builder.Name, | 46 Label: builder.Name, |
| 52 URL: fmt.Sprintf("/buildbucket/%s/%s", bucket.
Name, builder.Name), | 47 URL: fmt.Sprintf("/buildbucket/%s/%s", bucket.
Name, builder.Name), |
| 53 } | 48 } |
| 54 } | 49 } |
| 55 result.BuilderGroups[i] = group | 50 result.BuilderGroups[i] = group |
| 56 } | 51 } |
| 57 | 52 |
| 58 return result, nil | 53 return result, nil |
| 59 } | 54 } |
| OLD | NEW |