From 5589652282f5255cdfb36e86ea098c781557c580 Mon Sep 17 00:00:00 2001 From: Xinan Lin Date: Thu, 19 Nov 2020 01:21:20 +0000 Subject: [PATCH] Revert "Improve the setup logic for tryserver" This reverts commit 4447336100328230102b0c90625f44c00c9c5a8c. Reason for revert: Breaks infra repo. See crrev.com/c/2548285 Original change's description: > Improve the setup logic for tryserver > > If the given change does not have a valid gerrit host name, stop > initializing the tryserver module. > Also polished the variable name and docstr added in crrev/c/2528670. > > Recipe-Nontrivial-Roll: infra > Bug:1146487 > Change-Id: I38193b25d37c724fd41d898eb020237fbf7cecdf > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2544000 > Commit-Queue: Xinan Lin > Reviewed-by: Nodir Turakulov > Reviewed-by: Andrii Shyshkalov TBR=nodir@chromium.org,tandrii@google.com,recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com,linxinan@chromium.org,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com Change-Id: I3871866454adab816ab5549f8273fe16af2d9adb No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 1146487 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2548409 Reviewed-by: Xinan Lin Commit-Queue: Xinan Lin --- recipes/README.recipes.md | 14 +++++++------- recipes/recipe_modules/bot_update/api.py | 14 +++++++------- recipes/recipe_modules/tryserver/api.py | 14 +++++++------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/recipes/README.recipes.md b/recipes/README.recipes.md index 3b526b512..d83d7b8eb 100644 --- a/recipes/README.recipes.md +++ b/recipes/README.recipes.md @@ -63,7 +63,7 @@ Wrapper for easy calling of bot_update. Deapplies a patch, taking care of DEPS and solution revisions properly. -— **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, with_branch_heads=False, with_tags=False, no_fetch_tags=False, refs=None, patch_oauth2=None, oauth2_json=None, use_site_config_creds=None, clobber=False, root_solution_revision=None, rietveld=None, issue=None, patchset=None, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, accept_input_gerrit_changes=True, disable_syntax_validation=False, patch_refs=None, ignore_input_commit=False, add_blamelists=False, set_output_commit=False, step_test_data=None, enforce_fetch=False, \*\*kwargs):** +— **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, with_branch_heads=False, with_tags=False, no_fetch_tags=False, refs=None, patch_oauth2=None, oauth2_json=None, use_site_config_creds=None, clobber=False, root_solution_revision=None, rietveld=None, issue=None, patchset=None, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, accept_buildbucket_input=True, disable_syntax_validation=False, patch_refs=None, ignore_input_commit=False, add_blamelists=False, set_output_commit=False, step_test_data=None, enforce_fetch=False, \*\*kwargs):** Args: * gclient_config: The gclient configuration to use when running bot_update. @@ -90,11 +90,11 @@ Args: Use test_api.output_json to generate test data. * enforce_fetch: Enforce a new fetch to refresh the git cache, even if the solution revision passed in already exists in the current git cache. - * accept_input_gerrit_changes: if True, get the patchset from - self.m.buildbucket.build.input.gerrit_changes, with an assertion that - the size of self.m.buildbucket.build.input.gerrit_changes is one, - because bot_update module ONLY supports one change. Users may specify a - change via tryserver.set_change() and explicitly set this flag False. + * accept_buildbucket_input: should get the patchset from + buildbucket.build.input.gerrit_changes. If True, the input size is + asserted to be one, because bot_update module ONLY supports one CL. + Users may specify a CL via tryserver.set_change() and explicitly set + this flag False. — **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#506)(self, project_name, gclient_config=None):** @@ -869,7 +869,7 @@ Returns true iff we have a change to check out. Set the gerrit change for this module. Args: - * change: a self.m.buildbucket.common_pb2.GerritChange. + * cl: a GerritChange object. — **def [set\_compile\_failure\_tryjob\_result](/recipes/recipe_modules/tryserver/api.py#196)(self):** diff --git a/recipes/recipe_modules/bot_update/api.py b/recipes/recipe_modules/bot_update/api.py index 2ab8aed8c..10c5e5f1e 100644 --- a/recipes/recipe_modules/bot_update/api.py +++ b/recipes/recipe_modules/bot_update/api.py @@ -88,7 +88,7 @@ class BotUpdateApi(recipe_api.RecipeApi): patchset=None, gerrit_no_reset=False, gerrit_no_rebase_patch_ref=False, - accept_input_gerrit_changes=True, + accept_buildbucket_input=True, disable_syntax_validation=False, patch_refs=None, ignore_input_commit=False, @@ -123,11 +123,11 @@ class BotUpdateApi(recipe_api.RecipeApi): Use test_api.output_json to generate test data. * enforce_fetch: Enforce a new fetch to refresh the git cache, even if the solution revision passed in already exists in the current git cache. - * accept_input_gerrit_changes: if True, get the patchset from - self.m.buildbucket.build.input.gerrit_changes, with an assertion that - the size of self.m.buildbucket.build.input.gerrit_changes is one, - because bot_update module ONLY supports one change. Users may specify a - change via tryserver.set_change() and explicitly set this flag False. + * accept_buildbucket_input: should get the patchset from + buildbucket.build.input.gerrit_changes. If True, the input size is + asserted to be one, because bot_update module ONLY supports one CL. + Users may specify a CL via tryserver.set_change() and explicitly set + this flag False. """ assert use_site_config_creds is None, "use_site_config_creds is deprecated" assert rietveld is None, "rietveld is deprecated" @@ -136,7 +136,7 @@ class BotUpdateApi(recipe_api.RecipeApi): assert patch_oauth2 is None, "patch_oauth2 is deprecated" assert oauth2_json is None, "oauth2_json is deprecated" assert not (ignore_input_commit and set_output_commit) - if accept_input_gerrit_changes: + if accept_buildbucket_input: assert len(self.m.buildbucket.build.input.gerrit_changes) <= 1, ( 'bot_update does not support more than one ' 'buildbucket.build.input.gerrit_changes') diff --git a/recipes/recipe_modules/tryserver/api.py b/recipes/recipe_modules/tryserver/api.py index b87d03cf3..3716dd377 100644 --- a/recipes/recipe_modules/tryserver/api.py +++ b/recipes/recipe_modules/tryserver/api.py @@ -261,12 +261,12 @@ class TryserverApi(recipe_api.RecipeApi): """Set the gerrit change for this module. Args: - * change: a self.m.buildbucket.common_pb2.GerritChange. + * cl: a GerritChange object. """ + self._gerrit_info_initialized = False + self._gerrit_change = change + git_host = change.host gs_suffix = '-review.googlesource.com' - if change.host.endswith(gs_suffix): - self._gerrit_info_initialized = False - self._gerrit_change = change - git_host = '%s.googlesource.com' % change.host[:-len(gs_suffix)] - self._gerrit_change_repo_url = 'https://%s/%s' % (git_host, - change.project) + if git_host.endswith(gs_suffix): + git_host = '%s.googlesource.com' % git_host[:-len(gs_suffix)] + self._gerrit_change_repo_url = 'https://%s/%s' % (git_host, change.project)