Commit 11bc3991 authored by Nodir Turakulov's avatar Nodir Turakulov Committed by Commit Bot

[bot_update] add ignore_input_commit parameter

CrOS chromium-pfq builder uses bot_update, but checks out Chromium on its own,
effectively ignoring input commit in bot_update.
To resolve a P0, add ignore_input_commit parameter.
Long term, bot_update API must be redesigned.

TBR=tandrii@chromium.org
Bug: 882094
Change-Id: I4f43348e3d5f81bf603dd2c110829bce58acad16
Reviewed-on: https://chromium-review.googlesource.com/1216787Reviewed-by: 's avatarLann Martin <lannm@chromium.org>
Commit-Queue: Nodir Turakulov <nodir@chromium.org>
parent d91f0adc
...@@ -80,7 +80,7 @@ class BotUpdateApi(recipe_api.RecipeApi): ...@@ -80,7 +80,7 @@ class BotUpdateApi(recipe_api.RecipeApi):
patchset=None, gerrit_no_reset=False, patchset=None, gerrit_no_reset=False,
gerrit_no_rebase_patch_ref=False, gerrit_no_rebase_patch_ref=False,
disable_syntax_validation=False, manifest_name=None, disable_syntax_validation=False, manifest_name=None,
patch_refs=None, patch_refs=None, ignore_input_commit=False,
**kwargs): **kwargs):
""" """
Args: Args:
...@@ -153,6 +153,9 @@ class BotUpdateApi(recipe_api.RecipeApi): ...@@ -153,6 +153,9 @@ class BotUpdateApi(recipe_api.RecipeApi):
if solution.revision: if solution.revision:
revisions[solution.name] = solution.revision revisions[solution.name] = solution.revision
# HACK: ensure_checkout API must be redesigned so that we don't pass such
# parameters. Existing semantics is too opiniated.
if not ignore_input_commit:
# Apply input gitiles_commit, if any. # Apply input gitiles_commit, if any.
input_commit = self.m.buildbucket.build.input.gitiles_commit input_commit = self.m.buildbucket.build.input.gitiles_commit
if input_commit.id or input_commit.ref: if input_commit.id or input_commit.ref:
...@@ -160,8 +163,8 @@ class BotUpdateApi(recipe_api.RecipeApi): ...@@ -160,8 +163,8 @@ class BotUpdateApi(recipe_api.RecipeApi):
# Note: this is not entirely correct. build.input.gitiles_commit # Note: this is not entirely correct. build.input.gitiles_commit
# definition says "The Gitiles commit to run against.". # definition says "The Gitiles commit to run against.".
# However, here we ignore it if the config specified a revision. # However, here we ignore it if the config specified a revision.
# This is necessary because existing builders rely on this behavior, e.g. # This is necessary because existing builders rely on this behavior,
# they want to force refs/heads/master at the config level. # e.g. they want to force refs/heads/master at the config level.
revisions[repo_path] = ( revisions[repo_path] = (
revisions.get(repo_path) or input_commit.id or input_commit.ref) revisions.get(repo_path) or input_commit.id or input_commit.ref)
......
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