build-chromeos.sh: Clean up cros repo after build

Kokoro will treat the files as build artifacts and tries to rsync
the ~80GB to the executor. See b/30309837.

BUG=b:2089374426
TEST=None

Change-Id: I71df011025a7cff664a134bdfbf5783709365358
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3611872
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This commit is contained in:
Dennis Kempin 2022-04-28 03:55:10 +00:00
parent 2c4f981ae4
commit 4ebb928ea4

View file

@ -65,6 +65,15 @@ build_and_test_crosvm() {
time cros_sdk cros_run_unit_tests --board "$BOARD" --packages "${PACKAGE_LIST[@]}"
}
cleanup_cros() {
# Delete cros repo to prevent it from being treated as a build artifact by Kokoro.
cros_sdk --delete || true
sudo rm -rf "${CROS_ROOT}" || true
# Call original cleanup function from common.sh
cleanup
}
trap cleanup_cros EXIT
main() {
mkdir -p "$CROS_ROOT"
cd "$CROS_ROOT"