Commit 8038dfe3 authored by Sergey Berezin's avatar Sergey Berezin Committed by Commit Bot

bot_update recipe: parameterize step name in apply_gerrit_ref

Needed for parity with Rietveld two-sided patch application.

BUG=628259
R=agable@chromium.org

Change-Id: I79221f54e89a9291257a71b70cc52acc51167854
Reviewed-on: https://chromium-review.googlesource.com/591047Reviewed-by: 's avatarAaron Gable <agable@chromium.org>
Commit-Queue: Sergey Berezin <sergeyberezin@chromium.org>
parent 5aeeb72c
......@@ -47,14 +47,14 @@ Recipe module to ensure a checkout is consistent on a bot.
Wrapper for easy calling of bot_update.
&mdash; **def [apply\_gerrit\_ref](/recipes/recipe_modules/bot_update/api.py#49)(self, root, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, gerrit_repo=None, gerrit_ref=None, \*\*kwargs):**
&mdash; **def [apply\_gerrit\_ref](/recipes/recipe_modules/bot_update/api.py#49)(self, root, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, gerrit_repo=None, gerrit_ref=None, step_name='apply_gerrit', \*\*kwargs):**
&mdash; **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#428)(self, bot_update_step):**
&mdash; **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#429)(self, bot_update_step):**
Deapplies a patch, taking care of DEPS and solution revisions properly.
&mdash; **def [ensure\_checkout](/recipes/recipe_modules/bot_update/api.py#70)(self, gclient_config=None, suffix=None, patch=True, update_presentation=True, patch_root=None, no_shallow=False, with_branch_heads=False, with_tags=False, refs=None, patch_oauth2=False, oauth2_json=False, use_site_config_creds=True, clobber=False, root_solution_revision=None, rietveld=None, issue=None, patchset=None, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, disable_syntax_validation=False, \*\*kwargs):**
&mdash; **def [ensure\_checkout](/recipes/recipe_modules/bot_update/api.py#71)(self, gclient_config=None, suffix=None, patch=True, update_presentation=True, patch_root=None, no_shallow=False, with_branch_heads=False, with_tags=False, refs=None, patch_oauth2=False, oauth2_json=False, use_site_config_creds=True, clobber=False, root_solution_revision=None, rietveld=None, issue=None, patchset=None, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, disable_syntax_validation=False, \*\*kwargs):**
Args:
use_site_config_creds: If the oauth2 credentials are in the buildbot
......@@ -71,7 +71,7 @@ Args:
Needed as migration paths for recipes dealing with older revisions,
such as bisect.
&mdash; **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#405)(self, project_name, gclient_config=None):**
&mdash; **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#406)(self, project_name, gclient_config=None):**
Returns all property names used for storing the checked-out revision of
a given project.
......
......@@ -48,7 +48,8 @@ class BotUpdateApi(recipe_api.RecipeApi):
# TODO(tandrii): refactor this into tryserver.maybe_apply_patch
def apply_gerrit_ref(self, root, gerrit_no_reset=False,
gerrit_no_rebase_patch_ref=False,
gerrit_repo=None, gerrit_ref=None, **kwargs):
gerrit_repo=None, gerrit_ref=None,
step_name='apply_gerrit', **kwargs):
apply_gerrit_path = self.resource('apply_gerrit.py')
kwargs.setdefault('infra_step', True)
cmd = [
......@@ -65,7 +66,7 @@ class BotUpdateApi(recipe_api.RecipeApi):
'PATH': [self.m.depot_tools.root],
}
with self.m.context(env_prefixes=env_prefixes):
return self.m.python('apply_gerrit', apply_gerrit_path, cmd, **kwargs)
return self.m.python(step_name, apply_gerrit_path, cmd, **kwargs)
def ensure_checkout(self, gclient_config=None, suffix=None,
patch=True, update_presentation=True,
......
......@@ -19,7 +19,7 @@
]
},
"infra_step": true,
"name": "apply_gerrit"
"name": "Custom apply gerrit step"
},
{
"name": "$result",
......
......@@ -48,12 +48,20 @@ def RunSteps(api):
api.properties.get('gerrit_no_rebase_patch_ref'))
if api.properties.get('test_apply_gerrit_ref'):
prop2arg = {
'gerrit_custom_repo': 'gerrit_repo',
'gerrit_custom_ref': 'gerrit_ref',
'gerrit_custom_step_name': 'step_name',
}
kwargs = {
prop2arg[p]: api.properties.get(p)
for p in prop2arg if api.properties.get(p)
}
api.bot_update.apply_gerrit_ref(
root='/tmp/test/root',
gerrit_no_reset=gerrit_no_reset,
gerrit_no_rebase_patch_ref=gerrit_no_rebase_patch_ref,
gerrit_repo=api.properties.get('gerrit_custom_repo'),
gerrit_ref=api.properties.get('gerrit_custom_ref'),
**kwargs
)
else:
bot_update_step = api.bot_update.ensure_checkout(
......@@ -165,6 +173,7 @@ def GenTests(api):
gerrit_no_reset=1,
gerrit_custom_repo='https://custom/repo',
gerrit_custom_ref='refs/changes/custom/1234567/1',
gerrit_custom_step_name='Custom apply gerrit step',
test_apply_gerrit_ref=True,
)
yield api.test('tryjob_v8') + api.properties(
......
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