Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(826)

Side by Side Diff: scripts/slave/recipe_modules/luci_config/api.py

Issue 1862383002: build: add recipe code for new autoroller (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from recipe_engine import recipe_api
6
7 class LuciConfigApi(recipe_api.RecipeApi):
8 def get_projects(self):
9 """Fetch the mapping of project id to url from luci-config.
10
11 Returns:
12 A dictionary mapping project id to its luci-config project spec (among
13 which there is a repo_url key).
14 """
15 cmd = ['curl', 'https://luci-config.appspot.com/_ah/api/config/v1/projects']
16 fetch_result = self.m.step('Get project urls',
martiniss 2016/04/07 18:27:59 Please change this to use the fetch module. See ht
Paweł Hajdan Jr. 2016/04/07 20:32:15 Would you be OK with a TODO? This is what recipe_r
martiniss 2016/04/07 21:27:12 A TODO is fine for now.
Paweł Hajdan Jr. 2016/04/08 08:47:00 Good point. Added a TODO.
17 cmd,
18 stdout=self.m.json.output(),
19 step_test_data=lambda: self.m.json.test_api.output_stream({
20 'projects': [
21 {
22 'repo_type': 'GITILES',
23 'id': 'recipe_engine',
24 'repo_url': 'https://repo.repo/recipes-py',
25 },
26 {
27 'repo_type': 'GITILES',
28 'id': 'build',
29 'repo_url': 'https://repo.repo/chromium/build',
30 }
31 ],
32 }))
33 mapping = {}
34 for project in fetch_result.stdout['projects']:
35 mapping[project['id']] = project
36 return mapping
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698