Commit 18785bb2 authored by Garrett Beaty's avatar Garrett Beaty Committed by LUCI CQ

Fix the environment for calling git number.

Calling git number requires that that depot tools is on the path so that
git-number can be found and requires the CHROME_HEADLESS environment
variable to be set.

Change-Id: Iabb8ec6732ca2bcc0f3209449e23a7d0a4f629e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3314033
Auto-Submit: Garrett Beaty <gbeaty@google.com>
Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
parent 3f1f2128
......@@ -375,7 +375,7 @@ Returns:
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-change
### *recipe_modules* / [git](/recipes/recipe_modules/git)
[DEPS](/recipes/recipe_modules/git/__init__.py#3): [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/runtime][recipe_engine/recipe_modules/runtime], [recipe\_engine/step][recipe_engine/recipe_modules/step]
[DEPS](/recipes/recipe_modules/git/__init__.py#3): [depot\_tools](#recipe_modules-depot_tools), [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/runtime][recipe_engine/recipe_modules/runtime], [recipe\_engine/step][recipe_engine/recipe_modules/step]
PYTHON_VERSION_COMPATIBILITY: PY2+3
......
PYTHON_VERSION_COMPATIBILITY = 'PY2+3'
DEPS = [
'depot_tools',
'recipe_engine/buildbucket',
'recipe_engine/context',
'recipe_engine/runtime',
......
......@@ -451,7 +451,12 @@ class GitApi(recipe_api.RecipeApi):
args = ['number']
args.extend(commitrefs or [])
step_result = self(*args,
stdout=self.m.raw_io.output_text(add_output_log=True),
step_test_data=step_test_data)
# Put depot_tools on the path so that git-number can be found
with self.m.depot_tools.on_path():
# git-number is only meant for use on bots, so it prints an error message
# if CHROME_HEADLESS is not set
with self.m.context(env={'CHROME_HEADLESS': '1'}):
step_result = self(*args,
stdout=self.m.raw_io.output_text(add_output_log=True),
step_test_data=step_test_data)
return [l.strip() for l in step_result.stdout.strip().splitlines()]
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