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

Side by Side Diff: recipes.py

Issue 2231253002: Add the ability to dump initial recipe properties. (Closed) Base URL: https://github.com/luci/recipes-py@recipes-proto-config
Patch Set: Rebarse Created 4 years, 4 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
« no previous file with comments | « recipe_engine/arguments_pb2.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The LUCI Authors. All rights reserved. 2 # Copyright 2015 The LUCI Authors. All rights reserved.
3 # Use of this source code is governed under the Apache License, Version 2.0 3 # Use of this source code is governed under the Apache License, Version 2.0
4 # that can be found in the LICENSE file. 4 # that can be found in the LICENSE file.
5 5
6 """Tool to interact with recipe repositories. 6 """Tool to interact with recipe repositories.
7 7
8 This tool operates on the nearest ancestor directory containing an 8 This tool operates on the nearest ancestor directory containing an
9 infra/config/recipes.cfg. 9 infra/config/recipes.cfg.
10 """ 10 """
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 os.makedirs(workdir) 150 os.makedirs(workdir)
151 151
152 old_cwd = os.getcwd() 152 old_cwd = os.getcwd()
153 os.chdir(workdir) 153 os.chdir(workdir)
154 stream_engine = stream.ProductStreamEngine( 154 stream_engine = stream.ProductStreamEngine(
155 stream.StreamEngineInvariants(), 155 stream.StreamEngineInvariants(),
156 stream.AnnotatorStreamEngine( 156 stream.AnnotatorStreamEngine(
157 sys.stdout, emit_timestamps=(args.timestamps or 157 sys.stdout, emit_timestamps=(args.timestamps or
158 op_args.annotation_flags.emit_timestamp))) 158 op_args.annotation_flags.emit_timestamp)))
159 with stream_engine: 159 with stream_engine:
160 # Emit initial properties if configured to do so.
161 if op_args.annotation_flags.emit_initial_properties:
162 with stream_engine.new_step_stream('Initial Properties') as s:
163 for key in sorted(properties.iterkeys()):
164 s.set_build_property(key, json.dumps(properties[key], sort_keys=True))
165
160 try: 166 try:
161 ret = recipe_run.run_steps( 167 ret = recipe_run.run_steps(
162 properties, stream_engine, 168 properties, stream_engine,
163 step_runner.SubprocessStepRunner(stream_engine), 169 step_runner.SubprocessStepRunner(stream_engine),
164 universe_view=universe_view) 170 universe_view=universe_view)
165 finally: 171 finally:
166 os.chdir(old_cwd) 172 os.chdir(old_cwd)
167 173
168 return handle_recipe_return(ret, args.output_result_json, stream_engine) 174 return handle_recipe_return(ret, args.output_result_json, stream_engine)
169 175
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 ret = main() 566 ret = main()
561 if not isinstance(ret, int): 567 if not isinstance(ret, int):
562 if ret is None: 568 if ret is None:
563 ret = 0 569 ret = 0
564 else: 570 else:
565 print >> sys.stderr, ret 571 print >> sys.stderr, ret
566 ret = 1 572 ret = 1
567 sys.stdout.flush() 573 sys.stdout.flush()
568 sys.stderr.flush() 574 sys.stderr.flush()
569 os._exit(ret) 575 os._exit(ret)
OLDNEW
« no previous file with comments | « recipe_engine/arguments_pb2.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698