From d258f10c3d840f5c3c8a9f9d559f12a358095392 Mon Sep 17 00:00:00 2001 From: Daniel Schultz Date: Thu, 11 Mar 2021 19:48:40 +0100 Subject: [PATCH] kokoro: Add hostcheck step This step checks the host environment. Right now, it only checks if a drive is mounted to /tmpfs. If it's not mounted, the run will be aborted and the dmesg printed. Signed-off-by: Daniel Schultz --- .github/kokoro/db-full.sh | 1 + .github/kokoro/db-quick.sh | 1 + .github/kokoro/steps/hostcheck.sh | 31 +++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100755 .github/kokoro/steps/hostcheck.sh diff --git a/.github/kokoro/db-full.sh b/.github/kokoro/db-full.sh index 792c1b5d..8938336c 100755 --- a/.github/kokoro/db-full.sh +++ b/.github/kokoro/db-full.sh @@ -11,6 +11,7 @@ set -e cd github/$KOKORO_DIR/ +source ./.github/kokoro/steps/hostcheck.sh source ./.github/kokoro/steps/hostsetup.sh source ./.github/kokoro/steps/hostinfo.sh source ./.github/kokoro/steps/git.sh diff --git a/.github/kokoro/db-quick.sh b/.github/kokoro/db-quick.sh index f8ff3b4e..6668d573 100755 --- a/.github/kokoro/db-quick.sh +++ b/.github/kokoro/db-quick.sh @@ -11,6 +11,7 @@ set -e cd github/$KOKORO_DIR/ +source ./.github/kokoro/steps/hostcheck.sh source ./.github/kokoro/steps/hostsetup.sh source ./.github/kokoro/steps/hostinfo.sh source ./.github/kokoro/steps/git.sh diff --git a/.github/kokoro/steps/hostcheck.sh b/.github/kokoro/steps/hostcheck.sh new file mode 100755 index 00000000..e2a83ff8 --- /dev/null +++ b/.github/kokoro/steps/hostcheck.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Copyright (C) 2017-2021 The Project X-Ray Authors. +# +# Use of this source code is governed by a ISC-style +# license that can be found in the LICENSE file or at +# https://opensource.org/licenses/ISC +# +# SPDX-License-Identifier: ISC + +set -e + +echo +echo "========================================" +echo "Check storage" +echo "----------------------------------------" +set -x +e +mount | grep /tmpfs +MOUNT_RET=$? +set +x -e +if [[ $MOUNT_RET != 0 ]] ; then + echo "----------------------------------------" + echo "Error: No storage is mounted on /tmpfs." + echo "----------------------------------------" + + echo "========================================" + echo "Dmesg dump" + echo "----------------------------------------" + dmesg + + exit $MOUNT_RET +fi