Commit fb28d48c authored by Aaron Gable's avatar Aaron Gable Committed by Commit Bot

git-cl-try: document auth_config for buildbucket

git_cl.py uses auth.py to authenticate to cr-buildbucket,
but when it does so, it caches the token under a key for the
current codereview host, not the buildbucket hostname.

This is confusing, but is the desired behavior, so that users
can use different credentials (e.g. chromium and google) when
communicating with buildbucket about CLs on different gerrit
hosts (e.g. chromium and chrome-internal).

To prevent other people from getting confused like I did,
add some documentation to this effect.

Change-Id: If16896d15423bbdecf9624393773ac01d0d16a66
Reviewed-on: https://chromium-review.googlesource.com/990674
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: 's avatarNodir Turakulov <nodir@chromium.org>
parent f3eed001
......@@ -430,7 +430,7 @@ def _trigger_try_jobs(auth_config, changelist, buckets, options, patchset):
"""Sends a request to Buildbucket to trigger try jobs for a changelist.
Args:
auth_config: AuthConfig for Rietveld.
auth_config: AuthConfig for Buildbucket.
changelist: Changelist that the try jobs are associated with.
buckets: A nested dict mapping bucket names to builders to tests.
options: Command-line options.
......@@ -442,6 +442,8 @@ def _trigger_try_jobs(auth_config, changelist, buckets, options, patchset):
assert patchset, 'CL must be uploaded first'
codereview_host = urlparse.urlparse(codereview_url).hostname
# Cache the buildbucket credentials under the codereview host key, so that
# users can use different credentials for different buckets.
authenticator = auth.get_authenticator_for_host(codereview_host, auth_config)
http = authenticator.authorize(httplib2.Http())
http.force_exception_to_status_code = True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment