44 lines
1.0 KiB
Bash
44 lines
1.0 KiB
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
# PostToolUse Bash hook: detect deploy commands and remind to test.
|
||
|
|
# Triggers after deploy-to-target.sh runs.
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
INPUT=$(cat)
|
||
|
|
|
||
|
|
CMD=$(python3 -c "
|
||
|
|
import json, sys
|
||
|
|
try:
|
||
|
|
data = json.loads(sys.stdin.read())
|
||
|
|
print(data.get('tool_input', {}).get('command', ''))
|
||
|
|
except: pass
|
||
|
|
" <<< "$INPUT")
|
||
|
|
|
||
|
|
# Only trigger on deploy commands or git push
|
||
|
|
if ! echo "$CMD" | grep -qE 'deploy-to-target|git\s+push'; then
|
||
|
|
exit 0
|
||
|
|
fi
|
||
|
|
|
||
|
|
TIMESTAMP=$(date '+%Y-%m-%d %H:%M')
|
||
|
|
|
||
|
|
python3 -c "
|
||
|
|
import json
|
||
|
|
|
||
|
|
message = '''Deploy detected at $TIMESTAMP.
|
||
|
|
|
||
|
|
Post-deploy checklist:
|
||
|
|
1. Test the web UI at http://192.168.1.228
|
||
|
|
2. Verify modified apps load correctly
|
||
|
|
3. Check backend logs: sudo journalctl -u archipelago -n 20
|
||
|
|
4. Check nginx: sudo tail -f /var/log/nginx/error.log
|
||
|
|
5. If building ISO, sync system configs to image-recipe/configs/
|
||
|
|
6. Update CHANGELOG.md if this is a notable change'''
|
||
|
|
|
||
|
|
output = {
|
||
|
|
'hookSpecificOutput': {
|
||
|
|
'hookEventName': 'PostToolUse',
|
||
|
|
'deployReminder': message
|
||
|
|
}
|
||
|
|
}
|
||
|
|
print(json.dumps(output))
|
||
|
|
"
|