diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md index da0c4f38e5..354b0cc73f 100644 --- a/recipes/README.recipes.md +++ b/recipes/README.recipes.md @@ -847,7 +847,7 @@ Raises: Returns a presubmit step. -— **def [execute](/recipes/recipe_modules/presubmit/api.py#115)(self, bot_update_step, skip_owners=False, run_all=False):** +— **def [execute](/recipes/recipe_modules/presubmit/api.py#120)(self, bot_update_step, skip_owners=False, run_all=False):** Runs presubmit and sets summary markdown if applicable. @@ -861,7 +861,7 @@ Args: Returns: a RawResult object, suitable for being returned from RunSteps. -— **def [prepare](/recipes/recipe_modules/presubmit/api.py#48)(self, root_solution_revision=None):** +— **def [prepare](/recipes/recipe_modules/presubmit/api.py#53)(self, root_solution_revision=None):** Sets up a presubmit run. @@ -880,7 +880,7 @@ Returns:   **@property**
— **def [presubmit\_support\_path](/recipes/recipe_modules/presubmit/api.py#25)(self):** -— **def [upload\_findings\_from\_result](/recipes/recipe_modules/presubmit/api.py#219)(self, result_json):** +— **def [upload\_findings\_from\_result](/recipes/recipe_modules/presubmit/api.py#224)(self, result_json):** Parse code findings from presubmit results and then upload them. diff --git a/recipes/recipe_modules/presubmit/api.py b/recipes/recipe_modules/presubmit/api.py index 9950d749ab..883505d340 100644 --- a/recipes/recipe_modules/presubmit/api.py +++ b/recipes/recipe_modules/presubmit/api.py @@ -36,6 +36,11 @@ class PresubmitApi(recipe_api.RecipeApi): cmd.extend(['--json_output', self.m.json.output()]) if self.m.resultdb.enabled: kwargs['wrapper'] = ('rdb', 'stream', '--') + if ('presubmit.resultdb_module' + in self.m.buildbucket.build.input.experiments): + kwargs['wrapper'] = ('rdb', 'stream', '-module-scheme', 'flat', + '-module-name', '//:presubmit', '--') + return self.m.step(name, cmd, **kwargs) @property diff --git a/recipes/recipe_modules/presubmit/tests/execute.py b/recipes/recipe_modules/presubmit/tests/execute.py index c13d5e8132..46dce530c4 100644 --- a/recipes/recipe_modules/presubmit/tests/execute.py +++ b/recipes/recipe_modules/presubmit/tests/execute.py @@ -61,6 +61,16 @@ def GenTests(api): post_process.StepCommandContains, 'presubmit', ['--dry_run']) + api.post_process(post_process.DropExpectation)) + yield (api.test('module_scheme_experiment') + + api.runtime(is_experimental=False) + api.buildbucket.try_build( + experiments={'presubmit.resultdb_module': 100}) + + api.cq(run_mode=api.cq.DRY_RUN) + + api.post_process(post_process.StatusSuccess) + + api.post_process(post_process.StepCommandContains, 'presubmit', [ + 'rdb', 'stream', '-module-scheme', 'flat', '-module-name', + '//:presubmit', '--' + ]) + api.post_process(post_process.DropExpectation)) + yield (api.test('skip_owners') + api.runtime(is_experimental=False) + api.buildbucket.try_build(project='infra') + api.properties(skip_owners=True) +