Use github directory if it exists.

Unfortunately, kokoro names the top-level directory per the SCM type. This
means there's no way to make the job names match; we simply need to probe for
the existence of the correct directory.

PiperOrigin-RevId: 251519409
This commit is contained in:
Adin Scannell 2019-06-04 14:42:25 -07:00 committed by Shentubot
parent 0c292cdaab
commit 6f92038ce0
2 changed files with 8 additions and 9 deletions

View File

@ -23,9 +23,11 @@ set -x
(which use_bazel.sh && use_bazel.sh latest) || which bazel
bazel version
# Switch into the workspace and checkout the appropriate commit.
if [[ -v KOKORO_GIT_COMMIT ]]; then
cd git/repo && git checkout "${KOKORO_GIT_COMMIT}"
# Switch into the workspace.
if [[ -v KOKORO_GIT_COMMIT ]] && [[ -d git/repo ]]; then
cd git/repo
elif [[ -v KOKORO_GIT_COMMIT ]] && [[ -d github/repo ]]; then
cd github/repo
fi
# Build runsc.

View File

@ -21,8 +21,10 @@ set -eux
# GLOBAL ENV VARS #
###################
if [[ -v KOKORO_GIT_COMMIT ]]; then
if [[ -v KOKORO_GIT_COMMIT ]] && [[ -d git/repo ]]; then
readonly WORKSPACE_DIR="${PWD}/git/repo"
elif [[ -v KOKORO_GIT_COMMIT ]] && [[ -d github/repo ]]; then
readonly WORKSPACE_DIR="${PWD}/github/repo"
else
readonly WORKSPACE_DIR="${PWD}"
fi
@ -46,11 +48,6 @@ readonly TEST_PACKAGES=("//pkg/..." "//runsc/..." "//tools/...")
(which use_bazel.sh && use_bazel.sh latest) || which bazel
bazel version
# Checkout the appropriate commit.
if [[ -v KOKORO_GIT_COMMIT ]]; then
(cd "${WORKSPACE_DIR}" && git checkout "${KOKORO_GIT_COMMIT}")
fi
# Load the kvm module.
sudo -n -E modprobe kvm