From 6005604ca056e65429c8c3afb3441bc8f28f125f Mon Sep 17 00:00:00 2001 From: Zihan Chen Date: Thu, 3 Nov 2022 20:41:25 +0000 Subject: [PATCH] infra/recipes: Use cherry-pick instead of checkout in crOS builder This should allow the builder to turn green as it will contain all reverts and patches only existed in crOS tree when trying to build. This is not sufficient to be used as presubmit because it relies on the target change being merged already. TEST=led get-builder luci.crosvm.ci:chromeos_hatch | led edit-cr-cl https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4004343 | led edit-recipe-bundle | led launch BUG=b:240692674 Change-Id: I3a4183bfbd007d82803e5a33a56f357868972e80 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4004343 Reviewed-by: Dennis Kempin Commit-Queue: Zihan Chen Auto-Submit: Zihan Chen --- infra/recipes/build_chromeos_hatch.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/infra/recipes/build_chromeos_hatch.py b/infra/recipes/build_chromeos_hatch.py index caecfcedc7..a99777f570 100644 --- a/infra/recipes/build_chromeos_hatch.py +++ b/infra/recipes/build_chromeos_hatch.py @@ -20,7 +20,7 @@ def RunSteps(api): with api.crosvm.cros_container_build_context(): gitilies = api.buildbucket.build.input.gitiles_commit upstream_url = "https://chromium.googlesource.com/crosvm/crosvm" - revision = gitilies.id or "HEAD" + revision = gitilies.id or "upstream/main" api.crosvm.step_in_container( "Sync repo", @@ -33,12 +33,23 @@ def RunSteps(api): cros=True, ) - # Overwrite crosvm with the upstream revision we need to test api.crosvm.step_in_container( - "Fetch upstream crosvm", ["git", "fetch", upstream_url], cros=True + "Add crosvm upstream remote", + ["git", "remote", "add", "upstream", upstream_url], + cros=True, ) + api.crosvm.step_in_container( - "Checkout upstream revision", ["git", "checkout", revision], cros=True + "Unshallow crosvm", ["git", "fetch", "cros", "--unshallow"], cros=True + ) + + api.crosvm.step_in_container( + "Fetch upstream crosvm", ["git", "fetch", "upstream"], cros=True + ) + + # Apply unmerged commit from upstream to crOS tree + api.crosvm.step_in_container( + "Cherry-pick from upstream revision", ["git", "cherry-pick", ".." + revision], cros=True ) api.crosvm.step_in_container(