diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md index 0e9f747da1..f3b974644c 100644 --- a/recipes/README.recipes.md +++ b/recipes/README.recipes.md @@ -763,12 +763,13 @@ Raises: Return a presubmit step. -— **def [execute](/recipes/recipe_modules/presubmit/api.py#77)(self, bot_update_step):** +— **def [execute](/recipes/recipe_modules/presubmit/api.py#77)(self, bot_update_step, skip_owners):** Runs presubmit and sets summary markdown if applicable. Args: bot_update_step: the StepResult from a previously executed bot_update step. + skip_owners: a boolean indicating whether Owners checks should be skipped. Returns: a RawResult object, suitable for being returned from RunSteps. @@ -1050,7 +1051,7 @@ Move things around in a loop! [DEPS](/recipes/recipe_modules/presubmit/tests/execute.py#10): [gclient](#recipe_modules-gclient), [presubmit](#recipe_modules-presubmit), [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/runtime][recipe_engine/recipe_modules/runtime] -— **def [RunSteps](/recipes/recipe_modules/presubmit/tests/execute.py#29)(api, patch_project, patch_repository_url):** +— **def [RunSteps](/recipes/recipe_modules/presubmit/tests/execute.py#23)(api):** ### *recipes* / [presubmit:tests/prepare](/recipes/recipe_modules/presubmit/tests/prepare.py) [DEPS](/recipes/recipe_modules/presubmit/tests/prepare.py#9): [gclient](#recipe_modules-gclient), [presubmit](#recipe_modules-presubmit), [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/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/runtime][recipe_engine/recipe_modules/runtime] diff --git a/recipes/recipe_modules/presubmit/api.py b/recipes/recipe_modules/presubmit/api.py index 2a0b7dea64..ec7b16c3ce 100644 --- a/recipes/recipe_modules/presubmit/api.py +++ b/recipes/recipe_modules/presubmit/api.py @@ -74,11 +74,12 @@ class PresubmitApi(recipe_api.RecipeApi): return bot_update_step - def execute(self, bot_update_step): + def execute(self, bot_update_step, skip_owners=False): """Runs presubmit and sets summary markdown if applicable. Args: bot_update_step: the StepResult from a previously executed bot_update step. + skip_owners: a boolean indicating whether Owners checks should be skipped. Returns: a RawResult object, suitable for being returned from RunSteps. """ @@ -109,6 +110,11 @@ class PresubmitApi(recipe_api.RecipeApi): '--upstream', upstream, # '' if not in bot_update mode. ]) + if skip_owners: + presubmit_args.extend([ + '--skip_canned', 'CheckOwners' + ]) + raw_result = result_pb2.RawResult() step_json = self( *presubmit_args, diff --git a/recipes/recipe_modules/presubmit/tests/execute.py b/recipes/recipe_modules/presubmit/tests/execute.py index 3d0cbb4f9d..6508c65efd 100644 --- a/recipes/recipe_modules/presubmit/tests/execute.py +++ b/recipes/recipe_modules/presubmit/tests/execute.py @@ -20,17 +20,12 @@ DEPS = [ ] -PROPERTIES = { - 'patch_project': recipe_api.Property(None), - 'patch_repository_url': recipe_api.Property(None), -} - - -def RunSteps(api, patch_project, patch_repository_url): +def RunSteps(api): api.gclient.set_config('infra') with api.context(cwd=api.path['cache'].join('builder')): bot_update_step = api.presubmit.prepare() - return api.presubmit.execute(bot_update_step) + skip_owners = api.properties.get('skip_owners', False) + return api.presubmit.execute(bot_update_step, skip_owners) def GenTests(api): @@ -56,6 +51,17 @@ def GenTests(api): api.post_process(post_process.DropExpectation) ) + yield ( + api.test('skip_owners') + + api.runtime(is_experimental=False, is_luci=True) + + api.buildbucket.try_build(project='infra') + + api.properties(skip_owners=True) + + api.post_process(post_process.StatusSuccess) + + api.post_process( + post_process.StepCommandContains, 'presubmit', ['--skip_canned', 'CheckOwners']) + + api.post_process(post_process.DropExpectation) + ) + yield ( api.test('timeout') + api.runtime(is_experimental=False, is_luci=True) +