update DB table
This commit is contained in:
@@ -37,14 +37,17 @@ EOF
|
||||
|
||||
# 1. CD into the repo path
|
||||
# 2. Execute command and capture output
|
||||
# 3. PIPESTATUS[1] captures the exit code of the CMD, not the 'cd' or 'tee'
|
||||
# 3. PIPESTATUS[0] captures the exit code of the eval "$CMD"
|
||||
echo "--- Execution Start ---" | tee -a >(sed 's/$/<br>/' >> "$LOG_FILE")
|
||||
cd "$REPO_PATH" && eval "$CMD" 2>&1 | tee -a >(sed 's/$/<br>/' >> "$LOG_FILE")
|
||||
EXIT_CODE=${PIPESTATUS[0]}
|
||||
echo "--- Execution End (Exit Code: $EXIT_CODE) ---" | tee -a >(sed 's/$/<br>/' >> "$LOG_FILE")
|
||||
|
||||
# Close HTML tags
|
||||
echo "</div></body></html>" >> "$LOG_FILE"
|
||||
|
||||
# Determine PASS/FAIL
|
||||
# We consider it a FAIL if the exit code is non-zero
|
||||
if [ $EXIT_CODE -eq 0 ]; then
|
||||
RESULT="PASS"
|
||||
else
|
||||
|
||||
@@ -8,6 +8,7 @@ Group=asf
|
||||
WorkingDirectory=/home/asf/testarena_backend
|
||||
Environment="PATH=/home/asf/testarena_backend/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
Environment="IDF_PATH=/home/asf/esp/esp-idf"
|
||||
Environment="XDG_RUNTIME_DIR=/tmp"
|
||||
Environment="DATABASE_URL=sqlite:////home/asf/testarena/testarena.db"
|
||||
ExecStart=/home/asf/testarena_backend/venv/bin/uvicorn testarena_app.main:app --host 0.0.0.0 --port 8000
|
||||
Restart=always
|
||||
|
||||
@@ -8,6 +8,7 @@ Group=asf
|
||||
WorkingDirectory=/home/asf/testarena_backend
|
||||
Environment="PATH=/home/asf/testarena_backend/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
Environment="IDF_PATH=/home/asf/esp/esp-idf"
|
||||
Environment="XDG_RUNTIME_DIR=/tmp"
|
||||
Environment="DATABASE_URL=sqlite:////home/asf/testarena/testarena.db"
|
||||
ExecStart=/home/asf/testarena_backend/venv/bin/python3 -m testarena_app.worker
|
||||
Restart=always
|
||||
|
||||
@@ -31,6 +31,9 @@ def update_json_status(queue_id, task_id, status, result=None):
|
||||
|
||||
import datetime
|
||||
import time
|
||||
import os
|
||||
|
||||
os.environ["XDG_RUNTIME_DIR"] = "/tmp"
|
||||
|
||||
def run_command_with_logging(cmd, log_file, cwd=None, env=None, timeout=1800, stop_string=None):
|
||||
"""Runs a command, logs output, and optionally stops when a string is found."""
|
||||
|
||||
Reference in New Issue
Block a user