Reland "bot_update: make --output_json required in script invocation."

This is a reland of 331a276b54
Original change's description:
> bot_update: make --output_json required in script invocation.
> 
> It's already set by recipe, so this should have 0 difference in prod.
> 
> R=iannucci@chromium.org
> 
> Bug:
> Change-Id: I1e1129b9748d6647e45eb26892c8e892019fe088
> Reviewed-on: https://chromium-review.googlesource.com/769164
> Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
> Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>

Change-Id: I165da9650df6b5e8d382aafc30914eff9a524c56
Reviewed-on: https://chromium-review.googlesource.com/777820
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
changes/20/777820/3
Andrii Shyshkalov 8 years ago committed by Commit Bot
parent 276e0454b7
commit 8762632eb7

@ -1034,6 +1034,9 @@ def parse_args():
with open(options.spec_path, 'r') as fd: with open(options.spec_path, 'r') as fd:
options.specs = fd.read() options.specs = fd.read()
if not options.output_json:
parse.error('--output_json is required')
if not options.git_cache_dir: if not options.git_cache_dir:
parse.error('--git-cache-dir is required') parse.error('--git-cache-dir is required')
@ -1086,8 +1089,6 @@ def prepare(options, git_slns, active):
step_text = '[%dGB/%dGB used (%d%%)]' % (used_disk_space_gb, step_text = '[%dGB/%dGB used (%d%%)]' % (used_disk_space_gb,
total_disk_space_gb, total_disk_space_gb,
percent_used) percent_used)
if not options.output_json:
print '@@@STEP_TEXT@%s@@@' % step_text
shallow = (total_disk_space < SHALLOW_CLONE_THRESHOLD shallow = (total_disk_space < SHALLOW_CLONE_THRESHOLD
and not options.no_shallow) and not options.no_shallow)
@ -1149,17 +1150,16 @@ def checkout(options, git_slns, specs, revisions, step_text, shallow):
ensure_no_checkout(dir_names, options.cleanup_dir) ensure_no_checkout(dir_names, options.cleanup_dir)
gclient_output = ensure_checkout(**checkout_parameters) gclient_output = ensure_checkout(**checkout_parameters)
except PatchFailed as e: except PatchFailed as e:
if options.output_json: # Tell recipes information such as root, got_revision, etc.
# Tell recipes information such as root, got_revision, etc. emit_json(options.output_json,
emit_json(options.output_json, did_run=True,
did_run=True, root=first_sln,
root=first_sln, patch_apply_return_code=e.code,
patch_apply_return_code=e.code, patch_root=options.patch_root,
patch_root=options.patch_root, patch_failure=True,
patch_failure=True, failed_patch_body=e.output,
failed_patch_body=e.output, step_text='%s PATCH FAILED' % step_text,
step_text='%s PATCH FAILED' % step_text, fixed_revisions=revisions)
fixed_revisions=revisions)
raise raise
# Take care of got_revisions outputs. # Take care of got_revisions outputs.
@ -1182,18 +1182,17 @@ def checkout(options, git_slns, specs, revisions, step_text, shallow):
got_revisions = { 'got_revision': 'BOT_UPDATE_NO_REV_FOUND' } got_revisions = { 'got_revision': 'BOT_UPDATE_NO_REV_FOUND' }
#raise Exception('No got_revision(s) found in gclient output') #raise Exception('No got_revision(s) found in gclient output')
if options.output_json: # Tell recipes information such as root, got_revision, etc.
# Tell recipes information such as root, got_revision, etc. emit_json(options.output_json,
emit_json(options.output_json, did_run=True,
did_run=True, root=first_sln,
root=first_sln, patch_root=options.patch_root,
patch_root=options.patch_root, step_text=step_text,
step_text=step_text, fixed_revisions=revisions,
fixed_revisions=revisions, properties=got_revisions,
properties=got_revisions, manifest=create_manifest_old(),
manifest=create_manifest_old(), source_manifest=create_manifest(
source_manifest=create_manifest( gclient_output, options.patch_root, options.gerrit_ref))
gclient_output, options.patch_root, options.gerrit_ref))
def print_debug_info(): def print_debug_info():

Loading…
Cancel
Save