synth-diagnostic starts pipeline services, cleans up on failure

- run-tests.sh: starts pipeline services, runs test-unit.py,
  stops services on failure, leaves running on success
- synth-diagnostic is the single gate for pipeline startup
- deploy: stop pipeline → restart prometheus → start synth-diagnostic
  (synth-diagnostic starts pipeline on success)
This commit is contained in:
2026-06-24 02:49:58 -07:00
parent b445c272fb
commit 8e82286287
2 changed files with 11 additions and 5 deletions
+1 -1
View File
@@ -104,9 +104,9 @@ deploy:
cd {{REPO_DIR}} && git pull && \ cd {{REPO_DIR}} && git pull && \
chmod +x scripts/*.py scripts/*.sh 2>/dev/null; \ chmod +x scripts/*.py scripts/*.sh 2>/dev/null; \
echo '{{BOARD_PASS}}' | sudo -S systemctl daemon-reload && \ echo '{{BOARD_PASS}}' | sudo -S systemctl daemon-reload && \
echo '{{BOARD_PASS}}' | sudo -S systemctl stop midi-bridge pd-synth-onboard led-matrix-viz && \
echo '{{BOARD_PASS}}' | sudo -S systemctl restart prometheus-exporter && \ echo '{{BOARD_PASS}}' | sudo -S systemctl restart prometheus-exporter && \
echo '{{BOARD_PASS}}' | sudo -S systemctl start synth-diagnostic && \ echo '{{BOARD_PASS}}' | sudo -S systemctl start synth-diagnostic && \
echo '{{BOARD_PASS}}' | sudo -S systemctl restart midi-bridge pd-synth-onboard led-matrix-viz && \
echo '[OK] Deployed + restarted'" echo '[OK] Deployed + restarted'"
# Start synth (onboard audio) # Start synth (onboard audio)
+10 -4
View File
@@ -1,19 +1,25 @@
#!/bin/bash #!/bin/bash
# run-tests.sh — wrapper for test-unit.py with exit code mapping # run-tests.sh — start services, run tests, clean up on failure
set -euo pipefail set -euo pipefail
BOARD="${BOARD_HOST:-192.168.9.167}" BOARD="${BOARD_HOST:-192.168.9.167}"
cd /home/arduino/uno-q-audio-synth cd /home/arduino/uno-q-audio-synth
echo "[diag] Running synth pipeline diagnostics against $BOARD..." echo "[diag] Starting pipeline services for diagnostics..."
sudo systemctl start midi-bridge pd-synth-onboard led-matrix-viz
echo "[diag] Waiting 3s for services to settle..."
sleep 3
echo "[diag] Running synth pipeline diagnostics against $BOARD..."
python3 scripts/test-unit.py "$BOARD" python3 scripts/test-unit.py "$BOARD"
exit_code=$? exit_code=$?
if [ $exit_code -eq 0 ]; then if [ $exit_code -eq 0 ]; then
echo "[diag] All tests PASSED — pipeline healthy" echo "[diag] All tests PASSED — pipeline healthy, leaving services running"
else else
echo "[diag] Tests FAILED (exit $exit_code) — check dashboard for details" echo "[diag] Tests FAILED (exit $exit_code) — stopping pipeline services"
sudo systemctl stop midi-bridge pd-synth-onboard led-matrix-viz
fi fi
exit $exit_code exit $exit_code