Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

fix(demo-deploy): guard repo params; time-box the distro integration job

Juan Denis48899d58492f
diff --git a/.github/workflows/test-system-utils.yml b/.github/workflows/test-system-utils.yml
index 60045712..133ac1ed 100644
--- a/.github/workflows/test-system-utils.yml
+++ b/.github/workflows/test-system-utils.yml
@@ -28,6 +28,9 @@ jobs:
integration-tests:
name: Integration (${{ matrix.distro }})
runs-on: ubuntu-latest
+ # A wedged apt mirror once held the ubuntu job "in progress" for 2 h, and
+ # Version Bump waits on every sibling — fail fast instead of blocking dev.
+ timeout-minutes: 15
strategy:
fail-fast: false
@@ -60,8 +63,8 @@ jobs:
run: |
if command -v apt-get >/dev/null 2>&1; then
rm -rf /var/lib/apt/lists/*
- apt-get update
- apt-get install -y python3 python3-pip
+ apt-get -o Acquire::Retries=3 -o Acquire::http::Timeout=30 update
+ apt-get -o Acquire::Retries=3 -o Acquire::http::Timeout=30 -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold install -y python3 python3-pip
elif command -v dnf >/dev/null 2>&1; then
dnf install -y python3 python3-pip
elif command -v yum >/dev/null 2>&1; then
diff --git a/backend/app/services/demo_deploy_service.py b/backend/app/services/demo_deploy_service.py
index 6b508481..231142cc 100644
--- a/backend/app/services/demo_deploy_service.py
+++ b/backend/app/services/demo_deploy_service.py
@@ -92,7 +92,10 @@ def _repo_steps(params=None):
name = p.get('app_name') or 'my-app'
repo = p.get('repo_url') or 'https://github.com/example/my-app.git'
branch = p.get('branch') or 'main'
- port = int(p.get('port') or 3000)
+ try:
+ port = int(p.get('port') or 3000)
+ except (TypeError, ValueError):
+ port = 3000
health = p.get('health_path') or '/health'
dockerfile = p.get('dockerfile') or 'Dockerfile'
image = f'{name}:{branch}'
@@ -348,9 +351,11 @@ class DemoDeployService:
# `pace` lets a parameterised run stream slower/faster than the
# speed preset (e.g. 2.5 = ~0.75 s/line at 'realtime').
try:
- factor = float((plan.get('params') or {}).get('pace') or factor)
+ pace = float((plan.get('params') or {}).get('pace'))
except (TypeError, ValueError):
- pass
+ pace = None
+ if pace is not None and pace > 0:
+ factor = pace
line_delay = min(0.8, delay * factor)
try:
diff --git a/backend/tests/test_demo_deploys.py b/backend/tests/test_demo_deploys.py
index 992d8c4b..0b919f4b 100644
--- a/backend/tests/test_demo_deploys.py
+++ b/backend/tests/test_demo_deploys.py
@@ -172,6 +172,18 @@ class TestRepoScenario:
assert detail['plan']['title'] == 'Deploying agentsite'
assert detail['plan']['params']['app_name'] == 'agentsite'
+ def test_repo_scenario_tolerates_bad_port_and_pace(self, client, auth_headers):
+ # A non-numeric port falls back to the default; a zero/negative pace is
+ # ignored rather than producing a negative line delay.
+ r = client.post('/api/v1/deployment-jobs/simulate?wait=true',
+ json={'scenario': 'repo', 'speed': 'instant',
+ 'params': {'port': 'not-a-port', 'pace': -3}},
+ headers=auth_headers)
+ assert r.status_code == 202, r.get_json()
+ job = r.get_json()['job']
+ assert job['status'] == 'succeeded'
+ assert any('3000' in l['message'] for l in job['logs'])
+
def test_repo_scenario_without_params_still_runs(self, client, auth_headers):
r = client.post('/api/v1/deployment-jobs/simulate?wait=true',
json={'scenario': 'repo', 'speed': 'instant'}, headers=auth_headers)