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

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: TODO 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 # TODO(phajdan.jr): switch to fetch recipe module.
16 # When we start passing auth token e.g. for internal projects,
17 # it'd be better not to leak it, even on internal-only builders.
18 cmd = ['curl', 'https://luci-config.appspot.com/_ah/api/config/v1/projects']
19 fetch_result = self.m.step('Get project urls',
20 cmd,
21 stdout=self.m.json.output(),
22 step_test_data=lambda: self.m.json.test_api.output_stream({
23 'projects': [
24 {
25 'repo_type': 'GITILES',
26 'id': 'recipe_engine',
27 'repo_url': 'https://repo.repo/recipes-py',
28 },
29 {
30 'repo_type': 'GITILES',
31 'id': 'build',
32 'repo_url': 'https://repo.repo/chromium/build',
33 }
34 ],
35 }))
36 mapping = {}
37 for project in fetch_result.stdout['projects']:
38 mapping[project['id']] = project
39 return mapping
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/luci_config/__init__.py ('k') | scripts/slave/recipe_modules/recipe_autoroller/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698