git-cl: Tell users to set SKIP_GCE_AUTH_FOR_GIT=1 when running on cloudtop.

Bug: 1059141
Change-Id: I0a4501946014bd567548fb5396c3dd761606a9bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2091584
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
changes/84/2091584/16
Edward Lemur 5 years ago committed by LUCI CQ
parent 83217f0f11
commit 57d4742bbb

@ -101,6 +101,8 @@ class Authenticator(object):
# which then must use it.
if LuciContextAuthenticator.is_luci():
return LuciContextAuthenticator()
# TODO(crbug.com/1059384): Automatically detect when running on cloudtop,
# and use CookiesAuthenticator instead.
if GceAuthenticator.is_gce():
return GceAuthenticator()
return CookiesAuthenticator()
@ -465,6 +467,10 @@ def ReadHttpResponse(conn, accept_statuses=frozenset([200])):
host = auth_match.group(1) if auth_match else conn.req_host
print('Authentication failed. Please make sure your .gitcookies '
'file has credentials for %s.' % host)
# TODO(crbug.com/1059384): Automatically detect when running on cloudtop.
if isinstance(Authenticator.get(), GceAuthenticator):
print('If you\'re on a cloudtop instance, export '
'SKIP_GCE_AUTH_FOR_GIT=1 in your env.')
print('Try:\n git cl creds-check')
reason = '%s: %s' % (response.reason, contents)

@ -3396,14 +3396,16 @@ def CMDcreds_check(parser, args):
# Code below checks .gitcookies. Abort if using something else.
authn = gerrit_util.Authenticator.get()
if not isinstance(authn, gerrit_util.CookiesAuthenticator):
if isinstance(authn, gerrit_util.GceAuthenticator):
DieWithError(
'This command is not designed for GCE, are you on a bot?\n'
'If you need to run this on GCE, export SKIP_GCE_AUTH_FOR_GIT=1 '
'in your env.')
DieWithError(
message = (
'This command is not designed for bot environment. It checks '
'~/.gitcookies file not generally used on bots.')
# TODO(crbug.com/1059384): Automatically detect when running on cloudtop.
if isinstance(authn, gerrit_util.GceAuthenticator):
message += (
'\n'
'If you need to run this on GCE or a cloudtop instance, '
'export SKIP_GCE_AUTH_FOR_GIT=1 in your env.')
DieWithError(message)
checker = _GitCookiesChecker()
checker.ensure_configured_gitcookies()

Loading…
Cancel
Save