mirror of
https://github.com/techno-tim/k3s-ansible.git
synced 2026-08-09 07:23:19 +02:00
10bde4eff0
- reuse validated runner-owned Vagrant linked-clone masters\n- create the default guests in bounded two-machine batches\n- capture create timing and runner utilization diagnostics
48 lines
1.4 KiB
Bash
Executable File
48 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -Eeuo pipefail
|
|
|
|
output_dir="${1:-${RUNNER_TEMP:-/tmp}/k3s-ci-diagnostics}"
|
|
mkdir -p -- "$output_dir"
|
|
umask 077
|
|
|
|
run_capture() {
|
|
local output_file="$1"
|
|
shift
|
|
{
|
|
printf '$'
|
|
printf ' %q' "$@"
|
|
printf '\n'
|
|
"$@"
|
|
} > "$output_dir/$output_file" 2>&1 || true
|
|
}
|
|
|
|
run_capture system.txt uname -a
|
|
run_capture runner-user.txt id
|
|
run_capture memory.txt free -h
|
|
run_capture disk.txt df -h
|
|
run_capture virtualbox-version VBoxManage --version
|
|
run_capture virtualbox-vms VBoxManage list vms
|
|
run_capture virtualbox-running-vms VBoxManage list runningvms
|
|
run_capture virtualbox-disks VBoxManage list hdds
|
|
run_capture virtualbox-hostonlyifs VBoxManage list hostonlyifs
|
|
run_capture virtualbox-groups VBoxManage list groups
|
|
run_capture vagrant-status vagrant global-status
|
|
run_capture molecule-state find "${HOME}/.cache/molecule" -maxdepth 6 -type f -path '*/.vagrant/machines/*/virtualbox/id' -print
|
|
|
|
scenario_name="${K3S_CI_SCENARIO_NAME:-}"
|
|
if [[ "$scenario_name" =~ ^[A-Za-z0-9_-]+$ ]]; then
|
|
molecule_state_dir="${HOME}/.cache/molecule/k3s-ansible/${scenario_name}"
|
|
for log_name in vagrant.out vagrant.err; do
|
|
if [[ -r "${molecule_state_dir}/${log_name}" ]]; then
|
|
cp -- "${molecule_state_dir}/${log_name}" "$output_dir/${scenario_name}-${log_name}"
|
|
fi
|
|
done
|
|
fi
|
|
|
|
if [[ -r /etc/vbox/networks.conf ]]; then
|
|
cp -- /etc/vbox/networks.conf "$output_dir/virtualbox-networks.conf"
|
|
fi
|
|
|
|
printf 'Diagnostics written to %s\n' "$output_dir"
|