[presubmit] Use vpython3 on bots without vpython2

Bug: 1401307
Change-Id: Ie81608be8e8ec64ed569b0367f1426b4b2ab8b70
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4110968
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
changes/68/4110968/2
Michael Achenbach 2 years ago committed by LUCI CQ
parent 4f50adb332
commit 86cfa62b07

@ -758,7 +758,7 @@ Raises:
&mdash; **def [initialize](/recipes/recipe_modules/osx_sdk/api.py#48)(self):**
### *recipe_modules* / [presubmit](/recipes/recipe_modules/presubmit)
[DEPS](/recipes/recipe_modules/presubmit/__init__.py#13): [bot\_update](#recipe_modules-bot_update), [depot\_tools](#recipe_modules-depot_tools), [gclient](#recipe_modules-gclient), [git](#recipe_modules-git), [tryserver](#recipe_modules-tryserver), [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/cq][recipe_engine/recipe_modules/cq], [recipe\_engine/json][recipe_engine/recipe_modules/json], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/resultdb][recipe_engine/recipe_modules/resultdb], [recipe\_engine/step][recipe_engine/recipe_modules/step]
[DEPS](/recipes/recipe_modules/presubmit/__init__.py#13): [bot\_update](#recipe_modules-bot_update), [depot\_tools](#recipe_modules-depot_tools), [gclient](#recipe_modules-gclient), [git](#recipe_modules-git), [tryserver](#recipe_modules-tryserver), [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/cq][recipe_engine/recipe_modules/cq], [recipe\_engine/json][recipe_engine/recipe_modules/json], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/resultdb][recipe_engine/recipe_modules/resultdb], [recipe\_engine/step][recipe_engine/recipe_modules/step]
PYTHON_VERSION_COMPATIBILITY: PY2+3
@ -768,7 +768,7 @@ PYTHON_VERSION_COMPATIBILITY: PY2+3
Returns a presubmit step.
&mdash; **def [execute](/recipes/recipe_modules/presubmit/api.py#120)(self, bot_update_step, skip_owners=False, run_all=False):**
&mdash; **def [execute](/recipes/recipe_modules/presubmit/api.py#130)(self, bot_update_step, skip_owners=False, run_all=False):**
Runs presubmit and sets summary markdown if applicable.
@ -779,7 +779,7 @@ Args:
Returns:
a RawResult object, suitable for being returned from RunSteps.
&mdash; **def [prepare](/recipes/recipe_modules/presubmit/api.py#68)(self, root_solution_revision=None):**
&mdash; **def [prepare](/recipes/recipe_modules/presubmit/api.py#78)(self, root_solution_revision=None):**
Sets up a presubmit run.

@ -15,6 +15,7 @@ DEPS = [
'depot_tools',
'gclient',
'git',
'recipe_engine/buildbucket',
'recipe_engine/context',
'recipe_engine/cq',
'recipe_engine/json',

@ -30,7 +30,17 @@ class PresubmitApi(recipe_api.RecipeApi):
name = kwargs.pop('name', 'presubmit')
with self.m.depot_tools.on_path():
cmd = ['vpython', self.presubmit_support_path]
exe = 'vpython'
# Use only vpython3 on bots that don't have vpython2 on the path any
# longer.
# TODO(https://crbug.com/1401307): Switch this to vpython3 premanently
# and remove py3 part below.
experiments = self.m.buildbucket.build.input.experiments
if 'luci.buildbucket.omit_python2' in experiments:
exe = 'vpython3'
cmd = [exe, self.presubmit_support_path]
cmd.extend(args)
cmd.extend(['--json_output', self.m.json.output()])
if self.m.resultdb.enabled:

@ -69,6 +69,14 @@ def GenTests(api):
['--skip_canned', 'CheckOwners']) +
api.post_process(post_process.DropExpectation))
yield (api.test('vpython3') + api.runtime(is_experimental=False) +
api.buildbucket.try_build(
project='infra', experiments=['luci.buildbucket.omit_python2']) +
api.post_process(post_process.StepCommandContains, 'presubmit',
['vpython3']) +
api.post_process(post_process.StatusSuccess) +
api.post_process(post_process.DropExpectation))
yield (
api.test('timeout') + api.runtime(is_experimental=False) +
api.buildbucket.try_build(project='infra') +

Loading…
Cancel
Save