From 3509ca90e8d5820cf708b42d6ac2bdc023bb8894 Mon Sep 17 00:00:00 2001 From: pptx704 Date: Fri, 27 Mar 2026 00:28:32 +0600 Subject: [PATCH] Add pre/post build stages, fix exec timeout, expand guest PATH Build phases: - Pre-build (apt update) and post-build (apt clean, autoremove, rm lists) run with 10-minute timeout; user recipe commands keep 30s timeout - Log entries include phase field for UI grouping - Always send explicit TimeoutSec to host agent (0 defaulted to 30s) Frontend: - Pre-build/post-build steps show phase label without exposing commands - Recipe steps numbered independently starting from 1 Guest PATH: - Add /usr/games:/usr/local/games to wrenn-init.sh PATH export (standard Ubuntu paths, needed for packages like cowsay) --- frontend/src/lib/api/builds.ts | 1 + .../src/routes/admin/templates/+page.svelte | 17 ++- images/wrenn-init.sh | 2 +- internal/service/build.go | 114 +++++++++++------- 4 files changed, 84 insertions(+), 50 deletions(-) diff --git a/frontend/src/lib/api/builds.ts b/frontend/src/lib/api/builds.ts index 900acf2..349c6e1 100644 --- a/frontend/src/lib/api/builds.ts +++ b/frontend/src/lib/api/builds.ts @@ -2,6 +2,7 @@ import { apiFetch, type ApiResult } from '$lib/api/client'; export type BuildLogEntry = { step: number; + phase: string; // "pre-build", "recipe", or "post-build" cmd: string; stdout: string; stderr: string; diff --git a/frontend/src/routes/admin/templates/+page.svelte b/frontend/src/routes/admin/templates/+page.svelte index 0d719bd..dde8fc3 100644 --- a/frontend/src/routes/admin/templates/+page.svelte +++ b/frontend/src/routes/admin/templates/+page.svelte @@ -521,6 +521,9 @@ {#if build.logs && build.logs.length > 0}
{#each build.logs as log, i (i)} + {@const isInternal = log.phase === 'pre-build' || log.phase === 'post-build'} + {@const recipeIdx = log.phase === 'recipe' ? build.logs.filter(l => l.phase === 'recipe' && l.step <= log.step).length : 0} + {@const phaseLabel = isInternal ? (log.phase === 'pre-build' ? 'Pre-build' : 'Post-build') : `Step ${recipeIdx}`}