ci/kokoro: improve error checking

Check whether or not the rebase succeeds and fix a check that the script
is being run by kokoro.

BUG=None
TEST=tools/presubmit

Change-Id: I59ae6604c3535238f40a7df20c43b9db9e357fe3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3546578
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
This commit is contained in:
David Stevens 2022-03-24 10:06:39 +09:00 committed by Chromeos LUCI
parent 3a29174a7b
commit a7a04e6095

View file

@ -19,7 +19,7 @@ if [[ ! -z "${DEBUG_SSH_KEY}" ]]; then
fi
setup_source() {
if [ -z "${KOKORO_ARTIFACTS_DIR}/git" ]; then
if [ ! -d "${KOKORO_ARTIFACTS_DIR}" ]; then
echo "This script must be run in kokoro"
exit 1
fi
@ -49,6 +49,9 @@ setup_source() {
# us from rebasing the changes.
git checkout -f
git rebase origin/main
if [ $? -ne 0 ]; then
return 1
fi
echo "Fetching Submodules..."
git submodule update --init