mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-09 12:17:13 +00:00
Replace inline tail logic in deploy workflows with a shared scripts/ci/log-tail.sh helper that prints the last N lines of all log files on failure. This improves debuggability, avoids code duplication, and ensures consistent log output across server, universal and workstation pipelines. https://chatgpt.com/share/69661d0e-81a8-800f-8b98-6c964672d027
26 lines
526 B
Bash
Executable File
26 lines
526 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
LOG_DIR="${1:-logs}"
|
|
LINES="${2:-200}"
|
|
|
|
echo "=== DEBUG: logs ==="
|
|
ls -la "${LOG_DIR}" || true
|
|
echo
|
|
|
|
shopt -s nullglob
|
|
|
|
found=false
|
|
for f in "${LOG_DIR}"/*.log; do
|
|
found=true
|
|
echo "============================================================"
|
|
echo "=== Last ${LINES} lines of: ${f}"
|
|
echo "============================================================"
|
|
tail -n "${LINES}" "${f}" || true
|
|
echo
|
|
done
|
|
|
|
if [[ "${found}" = false ]]; then
|
|
echo "No log files found in ${LOG_DIR}"
|
|
fi
|