feat(ci): optimize Molecule VM creation

- 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
This commit is contained in:
Timothy Stewart
2026-08-01 01:15:25 -05:00
committed by Techno Tim
parent 57f234c8da
commit 10bde4eff0
14 changed files with 563 additions and 3 deletions
+44
View File
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
set -Eeuo pipefail
output_dir="${1:?output directory is required}"
interval="${2:-10}"
[[ "$interval" =~ ^[1-9][0-9]*$ ]] || {
printf 'monitor interval must be a positive integer\n' >&2
exit 2
}
mkdir -p -- "$output_dir"
umask 077
free -h > "$output_dir/memory-before.txt"
df -h > "$output_dir/disk-before.txt"
vmstat -w "$interval" > "$output_dir/vmstat.txt" &
vmstat_pid=$!
iostat_pid=""
if command -v iostat >/dev/null 2>&1; then
iostat -dx "$interval" > "$output_dir/iostat.txt" &
iostat_pid=$!
else
printf 'iostat is not installed on this runner\n' > "$output_dir/iostat-unavailable.txt"
fi
cleanup() {
local rc=$?
trap - EXIT INT TERM
kill "$vmstat_pid" 2>/dev/null || true
[[ -z "$iostat_pid" ]] || kill "$iostat_pid" 2>/dev/null || true
wait "$vmstat_pid" 2>/dev/null || true
[[ -z "$iostat_pid" ]] || wait "$iostat_pid" 2>/dev/null || true
free -h > "$output_dir/memory-after.txt"
df -h > "$output_dir/disk-after.txt"
exit "$rc"
}
trap cleanup EXIT INT TERM
while :; do
sleep 3600 &
wait $!
done