From fb28d48c74429b3402c95de7164388a18eea7832 Mon Sep 17 00:00:00 2001 From: Aaron Gable Date: Mon, 2 Apr 2018 13:08:06 -0700 Subject: [PATCH] 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 Reviewed-by: Andrii Shyshkalov Reviewed-by: Nodir Turakulov --- git_cl.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/git_cl.py b/git_cl.py index c28cc1a2d..e90b93f5c 100755 --- a/git_cl.py +++ b/git_cl.py @@ -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