| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. | 1 // Copyright 2016 The LUCI Authors. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 if err != nil { | 291 if err != nil { |
| 292 return nil, err | 292 return nil, err |
| 293 } | 293 } |
| 294 for _, cs := range p.Consoles { | 294 for _, cs := range p.Consoles { |
| 295 if cs.Name == consoleName { | 295 if cs.Name == consoleName { |
| 296 return cs, nil | 296 return cs, nil |
| 297 } | 297 } |
| 298 } | 298 } |
| 299 return nil, fmt.Errorf("Console %s not found in project %s", consoleName
, projName) | 299 return nil, fmt.Errorf("Console %s not found in project %s", consoleName
, projName) |
| 300 } | 300 } |
| 301 |
| 302 // GetConsolesForBuilder retrieves all the console definitions that this builder |
| 303 // belongs to. |
| 304 func GetConsolesForBuilder(c context.Context, builderName string) ([]*config.Con
sole, error) { |
| 305 projs, err := GetAllProjects(c) |
| 306 if err != nil { |
| 307 return nil, err |
| 308 } |
| 309 ret := []*config.Console{} |
| 310 for _, p := range projs { |
| 311 for _, cons := range p.Consoles { |
| 312 for _, b := range cons.Builders { |
| 313 if b.Name == builderName { |
| 314 ret = append(ret, cons) |
| 315 } |
| 316 } |
| 317 } |
| 318 } |
| 319 return ret, nil |
| 320 } |
| OLD | NEW |