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

Unified Diff: scripts/slave/annotated_run.py

Issue 860383008: Made annotated_run look up recipe from builders.pyl masters. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Review comments Created 5 years, 11 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
« no previous file with comments | « scripts/master/master_gen.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/annotated_run.py
diff --git a/scripts/slave/annotated_run.py b/scripts/slave/annotated_run.py
index 0f1f33d7c959278bf1d26301245e1cdca37067d5..819e4fa56db25a1740f1525b5cb325fb338c04d2 100755
--- a/scripts/slave/annotated_run.py
+++ b/scripts/slave/annotated_run.py
@@ -316,6 +316,39 @@ RecipeExecutionResult = collections.namedtuple(
'RecipeExecutionResult', 'status_code steps_ran')
+def get_recipe_properties(factory_properties, build_properties):
+ """Constructs the recipe's properties from buildbot's properties.
+
+ This merges factory_properties and build_properties. Furthermore, it
+ tries to reconstruct the 'recipe' property from builders.pyl if it isn't
+ already there, and in that case merges in properties form builders.pyl.
+ """
+ properties = factory_properties.copy()
+ properties.update(build_properties)
+
+ # Try to reconstruct the recipe from builders.pyl if not given.
+ if 'recipe' not in properties:
+ mastername = properties['mastername']
+ buildername = properties['buildername']
+
+ master_path = chromium_utils.MasterPath(mastername)
+ builders_file = os.path.join(master_path, 'builders.pyl')
+ if os.path.isfile(builders_file):
+ builders = chromium_utils.ReadBuildersFile(builders_file)
+ assert buildername in builders['builders'], (
+ 'buildername %s is not listed in %s' % (buildername, builders_file))
+ builder = builders['builders'][buildername]
+
+ # Update properties with builders.pyl data.
+ properties['recipe'] = builder['recipe']
+ properties.update(builder['properties'])
+ else:
+ raise LookupError('Cannot find recipe for %s on %s' %
+ (build_properties['buildername'],
+ build_properties['mastername']))
+ return properties
+
+
def run_steps(stream, build_properties, factory_properties,
test_data=recipe_test_api.DisabledTestData()):
"""Returns a tuple of (status_code, steps_ran).
@@ -337,8 +370,9 @@ def run_steps(stream, build_properties, factory_properties,
# destiny.
build_properties.pop('root', None)
- properties = factory_properties.copy()
- properties.update(build_properties)
+ properties = get_recipe_properties(
+ factory_properties=factory_properties,
+ build_properties=build_properties)
# TODO(iannucci): A much better way to do this would be to dynamically
# detect if the mirrors are actually available during the execution of the
@@ -358,8 +392,8 @@ def run_steps(stream, build_properties, factory_properties,
# to start executing code).
api = None
with stream.step('setup_build') as s:
- assert 'recipe' in factory_properties
- recipe = factory_properties['recipe']
+ assert 'recipe' in properties # Should be ensured by get_recipe_properties.
+ recipe = properties['recipe']
properties_to_print = properties.copy()
if 'use_mirror' in properties:
« no previous file with comments | « scripts/master/master_gen.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698