Harden KVM suite runner bootstrap
Some checks failed
KVM Publishable Validation / publishable-kvm-suite (push) Failing after 20s

This commit is contained in:
centra 2026-04-05 03:59:52 +09:00
parent 8bb926d66f
commit 26a306da1c
2 changed files with 15 additions and 3 deletions

View file

@ -40,12 +40,13 @@ jobs:
- name: Probe KVM Environment - name: Probe KVM Environment
run: | run: |
set -euo pipefail set -euo pipefail
export PATH="/run/current-system/sw/bin:/usr/bin:/bin:$PATH"
if [[ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]]; then if [[ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]]; then
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
elif [[ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then elif [[ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then
. "$HOME/.nix-profile/etc/profile.d/nix.sh" . "$HOME/.nix-profile/etc/profile.d/nix.sh"
fi fi
echo "hostname=$(hostname)" echo "hostname=$(uname -n)"
uname -a uname -a
id id
test -e /dev/kvm test -e /dev/kvm
@ -60,10 +61,11 @@ jobs:
- name: Run Publishable KVM Suite - name: Run Publishable KVM Suite
run: | run: |
set -euo pipefail set -euo pipefail
export PATH="/run/current-system/sw/bin:/usr/bin:/bin:$PATH"
if [[ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]]; then if [[ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]]; then
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
elif [[ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then elif [[ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then
. "$HOME/.nix-profile/etc/profile.d/nix.sh" . "$HOME/.nix-profile/etc/profile.d/nix.sh"
fi fi
chmod +x ./nix/test-cluster/run-publishable-kvm-suite.sh chmod +x ./nix/test-cluster/run-publishable-kvm-suite.sh
./nix/test-cluster/run-publishable-kvm-suite.sh "$RUNNER_TEMP/publishable-kvm-suite" bash ./nix/test-cluster/run-publishable-kvm-suite.sh "$RUNNER_TEMP/publishable-kvm-suite"

View file

@ -1,6 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
export PATH="/run/current-system/sw/bin:/usr/bin:/bin:${PATH}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
LOG_DIR="${1:-${ULTRACLOUD_KVM_PUBLISHABLE_LOG_DIR:-${REPO_ROOT}/work/publishable-kvm-suite}}" LOG_DIR="${1:-${ULTRACLOUD_KVM_PUBLISHABLE_LOG_DIR:-${REPO_ROOT}/work/publishable-kvm-suite}}"
@ -11,10 +13,18 @@ log() {
printf '[publishable-kvm-suite] %s\n' "$*" printf '[publishable-kvm-suite] %s\n' "$*"
} }
get_hostname() {
if command -v hostname >/dev/null 2>&1; then
hostname
else
uname -n
fi
}
capture_environment() { capture_environment() {
{ {
printf 'started_at=%s\n' "$(date -Is)" printf 'started_at=%s\n' "$(date -Is)"
printf 'hostname=%s\n' "$(hostname)" printf 'hostname=%s\n' "$(get_hostname)"
printf 'kernel=%s\n' "$(uname -a)" printf 'kernel=%s\n' "$(uname -a)"
printf 'pwd=%s\n' "$(pwd)" printf 'pwd=%s\n' "$(pwd)"
printf 'user=%s\n' "$(id -un)" printf 'user=%s\n' "$(id -un)"