Files
seaweedfs/seaweed-block/.github/scripts/require-nvme.sh
T
pingqiuandClaude Opus 5.5 a2419b2cec ci: judge tmpfs by filesystem type; an lsblk error voids its output
A tmpfs mounted under another source name (shm, a custom label) was
refused because the check compared the source name. And an lsblk that
printed an NVMe disk and then failed was accepted, since its status was
discarded. The check now reads the filesystem type from df and treats any
lsblk failure as "not a block device". Two stub cases pin both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 22:53:34 -08:00

37 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Fails a self-hosted job whose workspace, temp or Go cache directory is not
# on an NVMe disk. The process-level tests write and fsync real files; on a
# box whose system disk is SATA, a default runner install puts _work there and
# the tests time out under the disk load instead of failing on a real bug.
# A tmpfs directory is accepted (memory, not a slow disk).
# Usage: require-nvme.sh DIR...
set -euo pipefail
bad=0
for p in "$@"; do
[ -n "$p" ] || continue
d=$p
while [ ! -e "$d" ]; do d=$(dirname "$d"); done
read -r src fstype < <(df --output=source,fstype "$d" | tail -n 1)
if [ "$fstype" = tmpfs ]; then
echo "ok $p: $src (tmpfs)"
continue
fi
# Every disk under the source (all members of an array) must be NVMe; an
# lsblk error voids whatever it printed.
disks=
if tree=$(lsblk -nrso TYPE,TRAN "$src" 2>/dev/null); then
disks=$(printf '%s\n' "$tree" |
awk '$1 == "disk" { print ($2 == "" ? "unknown" : $2) }' | sort -u | tr '\n' ' ')
fi
if [ "$disks" = "nvme " ]; then
echo "ok $p: $src (nvme)"
else
echo "FAIL $p: $src (disk: ${disks:-not a block device})"
bad=1
fi
done
if [ "$bad" -ne 0 ]; then
echo "runner ${RUNNER_NAME:-?}: work, temp and Go cache directories must be on NVMe; move them before this runner takes jobs" >&2
exit 1
fi