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

Unified Diff: recipe_modules/bot_update/resources/bot_update.py

Issue 2294413002: bot_update: add --auth-refresh-token-json passthrough for apply_issue (Closed)
Patch Set: More coverage Created 4 years, 3 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: recipe_modules/bot_update/resources/bot_update.py
diff --git a/recipe_modules/bot_update/resources/bot_update.py b/recipe_modules/bot_update/resources/bot_update.py
index ab71dd4a9a5bf7feff021eb0b125643d9bb2aaa0..2323f4c4b14b57c88eb9f075a09acf31896a9e3d 100755
--- a/recipe_modules/bot_update/resources/bot_update.py
+++ b/recipe_modules/bot_update/resources/bot_update.py
@@ -555,7 +555,8 @@ def _download(url):
def apply_rietveld_issue(issue, patchset, root, server, _rev_map, _revision,
- email_file, key_file, whitelist=None, blacklist=None):
+ email_file, key_file, oauth2_file,
+ whitelist=None, blacklist=None):
apply_issue_bin = ('apply_issue.bat' if sys.platform.startswith('win')
else 'apply_issue')
cmd = [apply_issue_bin,
@@ -570,8 +571,10 @@ def apply_rietveld_issue(issue, patchset, root, server, _rev_map, _revision,
# Don't run gclient sync when it sees a DEPS change.
'--ignore_deps',
]
- # Use an oauth key file if specified.
- if email_file and key_file:
+ # Use an oauth key or json file if specified.
+ if oauth2_file:
+ cmd.extend(['--auth-refresh-token-json', oauth2_file])
+ elif email_file and key_file:
cmd.extend(['--email-file', email_file, '--private-key-file', key_file])
else:
cmd.append('--no-auth')
@@ -714,8 +717,9 @@ def ensure_deps_revisions(deps_url_mapping, solutions, revisions):
def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only,
patch_root, issue, patchset, rietveld_server, gerrit_repo,
gerrit_ref, gerrit_rebase_patch_ref, revision_mapping,
- apply_issue_email_file, apply_issue_key_file, shallow, refs,
- git_cache_dir, gerrit_reset):
+ apply_issue_email_file, apply_issue_key_file,
+ apply_issue_oauth2_file, shallow, refs, git_cache_dir,
+ gerrit_reset):
# Get a checkout of each solution, without DEPS or hooks.
# Calling git directly because there is no way to run Gclient without
# invoking DEPS.
@@ -738,7 +742,8 @@ def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only,
if issue:
apply_rietveld_issue(issue, patchset, patch_root, rietveld_server,
revision_mapping, git_ref, apply_issue_email_file,
- apply_issue_key_file, whitelist=[target])
+ apply_issue_key_file, apply_issue_oauth2_file,
+ whitelist=[target])
already_patched.append(target)
elif gerrit_ref:
apply_gerrit_ref(gerrit_repo, gerrit_ref, patch_root, gerrit_reset,
@@ -765,8 +770,9 @@ def ensure_checkout(solutions, revisions, first_sln, target_os, target_os_only,
# Apply the rest of the patch here (sans DEPS)
if issue:
apply_rietveld_issue(issue, patchset, patch_root, rietveld_server,
- revision_mapping, git_ref, apply_issue_email_file,
- apply_issue_key_file, blacklist=already_patched)
+ revision_mapping, apply_issue_oauth2_file, git_ref,
+ apply_issue_email_file, apply_issue_key_file,
+ blacklist=already_patched)
elif gerrit_ref and not applied_gerrit_patch:
# If gerrit_ref was for solution's main repository, it has already been
# applied above. This chunk is executed only for patches to DEPS-ed in
@@ -835,6 +841,9 @@ def parse_args():
parse.add_option('--apply_issue_key_file',
help='--private-key-file option passthrough for '
'apply_patch.py.')
+ parse.add_option('--apply_issue_oauth2_file',
+ help='--auth-refresh-token-json option passthrough for '
+ 'apply_patch.py.')
parse.add_option('--root', dest='patch_root',
help='DEPRECATED: Use --patch_root.')
parse.add_option('--patch_root', help='Directory to patch on top of.')
@@ -972,6 +981,7 @@ def checkout(options, git_slns, specs, revisions, step_text, shallow):
revision_mapping=options.revision_mapping,
apply_issue_email_file=options.apply_issue_email_file,
apply_issue_key_file=options.apply_issue_key_file,
+ apply_issue_oauth2_file=options.apply_issue_oauth2_file,
# Finally, extra configurations such as shallowness of the clone.
shallow=shallow,
« no previous file with comments | « recipe_modules/bot_update/example.expected/trychange_oauth2_json_win.json ('k') | tests/bot_update_coverage_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698