Files
ServerKit/backend/app/models/sandbox_run.py
T
Juan Denis 5e8012de61 Add test sandbox and harden install scripts
Introduces a full-stack Test Sandbox feature to run distro matrix tests in Docker from the UI: new backend API/service, sandbox_runs model + migration, run/log endpoints, and a new frontend page with mode selection, run history, live polling, cancel, and per-distro logs.

Also adds ARM64 scripts CI coverage (ubuntu-24.04-arm) and strengthens install/test automation for minimal images and overlay rebuilds: early curl/bootstrap index refresh, stricter venv validation, release-venv glibc fallback, Node reprovisioning on source fallback, rsync --delete overlay behavior, npm bootstrap in VM install, Windows tar pinning in PowerShell harness, plus updated test docs and distro coverage notes.
2026-07-20 22:26:19 -04:00

41 lines
1.6 KiB
Python

from datetime import datetime
from app import db
class SandboxRun(db.Model):
"""One Test Sandbox execution: a set of distro containers running the
installer / script test suites, driven from the Test Sandbox UI.
``results`` is a JSON object keyed by distro id:
``{"ubuntu22": {"status": "passed|failed|running|queued|skipped",
"detail": "...", "duration_s": 12.3}, ...}``
Per-distro full logs live on disk under
``instance/sandbox-runs/<id>/<distro>.log`` (see test_sandbox_service).
"""
__tablename__ = 'sandbox_runs'
id = db.Column(db.Integer, primary_key=True)
mode = db.Column(db.String(16), nullable=False, default='quick') # quick | full
distros = db.Column(db.JSON) # list of distro keys requested
# running | done | error | cancelled
status = db.Column(db.String(16), nullable=False, default='running', index=True)
results = db.Column(db.JSON)
error = db.Column(db.Text)
user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=True)
created_at = db.Column(db.DateTime, default=datetime.utcnow, index=True)
finished_at = db.Column(db.DateTime)
def to_dict(self):
return {
'id': self.id,
'mode': self.mode,
'distros': self.distros or [],
'status': self.status,
'results': self.results or {},
'error': self.error,
'user_id': self.user_id,
'created_at': self.created_at.isoformat() if self.created_at else None,
'finished_at': self.finished_at.isoformat() if self.finished_at else None,
}