From 50652dcd932fe987c9fbf1256c71ae7535c8d12f Mon Sep 17 00:00:00 2001 From: Zihan Chen Date: Mon, 14 Nov 2022 21:37:11 +0000 Subject: [PATCH] infra/recipes: Unshallow repo checkout few times as needed Turns out `git fetch --unshallow` once can be insufficient in some cases to move current checkout form grafted state. Use a loop to unshallow it until it's not shallow. TEST=led get-build 8797542734442160913 | led edit-recipe-bundle | led launch BUG=b:240692674 Change-Id: If2dbe08f0e3341aefc42afee9db8e8b39efab56a Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4026809 Reviewed-by: Daniel Verkamp Commit-Queue: Daniel Verkamp Auto-Submit: Zihan Chen --- infra/recipes/build_chromeos_hatch.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/infra/recipes/build_chromeos_hatch.py b/infra/recipes/build_chromeos_hatch.py index c894c84689..f4ca5481f7 100644 --- a/infra/recipes/build_chromeos_hatch.py +++ b/infra/recipes/build_chromeos_hatch.py @@ -40,7 +40,11 @@ def RunSteps(api): # Ignore errors from unshallow as repo sync sometimes resulted in full git history api.crosvm.step_in_container( - "Unshallow crosvm", ["git", "fetch", "cros", "--unshallow"], cros=True, ok_ret="any" + "Unshallow crosvm as needed", + [ + "for i in $(seq 1 5);do if [[ $(git rev-parse --is-shallow-repository) == 'true' ]]; then git fetch cros --unshallow; else break; fi; done" + ], + cros=True, ) api.crosvm.step_in_container("Print current git log", ["git", "log"], cros=True)