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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: scripts/slave/recipe_modules/luci_config/api.py
diff --git a/scripts/slave/recipe_modules/luci_config/api.py b/scripts/slave/recipe_modules/luci_config/api.py
new file mode 100644
index 0000000000000000000000000000000000000000..69f18ca07997f25c40d67e08ef959f4656269dad
--- /dev/null
+++ b/scripts/slave/recipe_modules/luci_config/api.py
@@ -0,0 +1,36 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from recipe_engine import recipe_api
+
+class LuciConfigApi(recipe_api.RecipeApi):
+ def get_projects(self):
+ """Fetch the mapping of project id to url from luci-config.
+
+ Returns:
+ A dictionary mapping project id to its luci-config project spec (among
+ which there is a repo_url key).
+ """
+ cmd = ['curl', 'https://luci-config.appspot.com/_ah/api/config/v1/projects']
+ 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.
+ cmd,
+ stdout=self.m.json.output(),
+ step_test_data=lambda: self.m.json.test_api.output_stream({
+ 'projects': [
+ {
+ 'repo_type': 'GITILES',
+ 'id': 'recipe_engine',
+ 'repo_url': 'https://repo.repo/recipes-py',
+ },
+ {
+ 'repo_type': 'GITILES',
+ 'id': 'build',
+ 'repo_url': 'https://repo.repo/chromium/build',
+ }
+ ],
+ }))
+ mapping = {}
+ for project in fetch_result.stdout['projects']:
+ mapping[project['id']] = project
+ return mapping

Powered by Google App Engine
This is Rietveld 408576698