Revert "Improve the setup logic for tryserver"

This reverts commit 4447336100.

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 <linxinan@chromium.org>
> Reviewed-by: Nodir Turakulov <nodir@chromium.org>
> Reviewed-by: Andrii Shyshkalov <tandrii@google.com>

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 <linxinan@chromium.org>
Commit-Queue: Xinan Lin <linxinan@chromium.org>
changes/09/2548409/2
Xinan Lin 5 years ago committed by LUCI CQ
parent 4447336100
commit 5589652282

@ -63,7 +63,7 @@ Wrapper for easy calling of bot_update.
Deapplies a patch, taking care of DEPS and solution revisions properly. Deapplies a patch, taking care of DEPS and solution revisions properly.
&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, 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):** &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, 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: Args:
* gclient_config: The gclient configuration to use when running bot_update. * 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. Use test_api.output_json to generate test data.
* enforce_fetch: Enforce a new fetch to refresh the git cache, even if the * 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. solution revision passed in already exists in the current git cache.
* accept_input_gerrit_changes: if True, get the patchset from * accept_buildbucket_input: should get the patchset from
self.m.buildbucket.build.input.gerrit_changes, with an assertion that buildbucket.build.input.gerrit_changes. If True, the input size is
the size of self.m.buildbucket.build.input.gerrit_changes is one, asserted to be one, because bot_update module ONLY supports one CL.
because bot_update module ONLY supports one change. Users may specify a Users may specify a CL via tryserver.set_change() and explicitly set
change via tryserver.set_change() and explicitly set this flag False. this flag False.
&mdash; **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#506)(self, project_name, gclient_config=None):** &mdash; **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. Set the gerrit change for this module.
Args: Args:
* change: a self.m.buildbucket.common_pb2.GerritChange. * cl: a GerritChange object.
&mdash; **def [set\_compile\_failure\_tryjob\_result](/recipes/recipe_modules/tryserver/api.py#196)(self):** &mdash; **def [set\_compile\_failure\_tryjob\_result](/recipes/recipe_modules/tryserver/api.py#196)(self):**

@ -88,7 +88,7 @@ class BotUpdateApi(recipe_api.RecipeApi):
patchset=None, patchset=None,
gerrit_no_reset=False, gerrit_no_reset=False,
gerrit_no_rebase_patch_ref=False, gerrit_no_rebase_patch_ref=False,
accept_input_gerrit_changes=True, accept_buildbucket_input=True,
disable_syntax_validation=False, disable_syntax_validation=False,
patch_refs=None, patch_refs=None,
ignore_input_commit=False, ignore_input_commit=False,
@ -123,11 +123,11 @@ class BotUpdateApi(recipe_api.RecipeApi):
Use test_api.output_json to generate test data. Use test_api.output_json to generate test data.
* enforce_fetch: Enforce a new fetch to refresh the git cache, even if the * 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. solution revision passed in already exists in the current git cache.
* accept_input_gerrit_changes: if True, get the patchset from * accept_buildbucket_input: should get the patchset from
self.m.buildbucket.build.input.gerrit_changes, with an assertion that buildbucket.build.input.gerrit_changes. If True, the input size is
the size of self.m.buildbucket.build.input.gerrit_changes is one, asserted to be one, because bot_update module ONLY supports one CL.
because bot_update module ONLY supports one change. Users may specify a Users may specify a CL via tryserver.set_change() and explicitly set
change via tryserver.set_change() and explicitly set this flag False. this flag False.
""" """
assert use_site_config_creds is None, "use_site_config_creds is deprecated" assert use_site_config_creds is None, "use_site_config_creds is deprecated"
assert rietveld is None, "rietveld 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 patch_oauth2 is None, "patch_oauth2 is deprecated"
assert oauth2_json is None, "oauth2_json is deprecated" assert oauth2_json is None, "oauth2_json is deprecated"
assert not (ignore_input_commit and set_output_commit) 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, ( assert len(self.m.buildbucket.build.input.gerrit_changes) <= 1, (
'bot_update does not support more than one ' 'bot_update does not support more than one '
'buildbucket.build.input.gerrit_changes') 'buildbucket.build.input.gerrit_changes')

@ -261,12 +261,12 @@ class TryserverApi(recipe_api.RecipeApi):
"""Set the gerrit change for this module. """Set the gerrit change for this module.
Args: Args:
* change: a self.m.buildbucket.common_pb2.GerritChange. * cl: a GerritChange object.
""" """
gs_suffix = '-review.googlesource.com'
if change.host.endswith(gs_suffix):
self._gerrit_info_initialized = False self._gerrit_info_initialized = False
self._gerrit_change = change self._gerrit_change = change
git_host = '%s.googlesource.com' % change.host[:-len(gs_suffix)] git_host = change.host
self._gerrit_change_repo_url = 'https://%s/%s' % (git_host, gs_suffix = '-review.googlesource.com'
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)

Loading…
Cancel
Save