Commit e57a6ebe authored by dnj@chromium.org's avatar dnj@chromium.org

Require 'CHROME_HEADLESS' to use 'git-number'.

Updated 'git-number' to produce an error message if it's run without the
CHROME_HEADLESS (bot) environment variable. This is intended to alert developers
who may be incorrectly using this tool to get positioning information instead of
the commit position.

BUG=409917
TEST=local
  - Ran with and without 'CHROME_HEADLESS'; observed the error message in the
    'without' case.

R=iannucci@chromium.org

Review URL: https://codereview.chromium.org/534703002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291773 0039d316-1c4b-4281-b951-d872f2087c98
parent 34504a15
......@@ -252,6 +252,13 @@ def main(): # pragma: no cover
levels = [logging.ERROR, logging.INFO, logging.DEBUG]
logging.basicConfig(level=levels[min(opts.verbose, len(levels) - 1)])
# 'git number' should only be used on bots.
if os.getenv('CHROME_HEADLESS') != '1':
logging.error("'git-number' is an infrastructure tool that is only "
"intended to be used internally by bots. Developers should "
"use the 'Cr-Commit-Position' value in the commit's message.")
return 1
try:
if opts.reset:
clear_caches(on_disk=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