Commit 1450d68
Eric Bower
·
2026-05-08 10:09:27 -0400 EDT
parent 15b8e8f
fix: html artifacts
1 files changed,
+32,
-16
M
main.go
M
main.go
+32,
-16
1@@ -1076,7 +1076,14 @@ func monitorTick(cfg *Cfg, log *slog.Logger, output io.Writer, jobStates map[str
2 }
3 }
4 // Write sentinel so we don't re-publish on subsequent ticks
5- if err := os.WriteFile(sentinel, []byte(status), 0644); err != nil {
6+ published := map[string]interface{}{
7+ "status": status,
8+ "exit_code": exitCode,
9+ "job_id": jobID,
10+ "finished_at": time.Now().UTC().Format(time.RFC3339),
11+ }
12+ publishedJSON, _ := json.Marshal(published)
13+ if err := os.WriteFile(sentinel, publishedJSON, 0644); err != nil {
14 log.Error("write published sentinel", "err", err)
15 }
16 } else {
17@@ -1795,23 +1802,32 @@ func generateJobIndex(artifactDir, name, jobID string, sessions []SessionInfo) (
18 // Gather other artifacts in the job directory
19 var artifacts []artifactRow
20 jobDir := filepath.Join(artifactDir, name, jobID)
21- if entries, err := os.ReadDir(jobDir); err == nil {
22- for _, e := range entries {
23- if e.IsDir() {
24- continue // skip subdirs (task dirs)
25- }
26- info, err := e.Info()
27- if err != nil {
28- continue
29- }
30- artifacts = append(artifacts, artifactRow{
31- Name: e.Name(),
32- Size: formatFileSize(info.Size()),
33- ModTime: formatTimestamp(fmt.Sprintf("%d", info.ModTime().Unix())),
34- })
35- }
36+
37+ // Always add workspace.tar (it's uploaded before pici runs)
38+ artifacts = append(artifacts, artifactRow{Name: "workspace.tar", Size: "—", ModTime: "—"})
39+
40+ // Add event.json if it exists
41+ eventJSON := filepath.Join(jobDir, "event.json")
42+ if info, err := os.Stat(eventJSON); err == nil {
43+ artifacts = append(artifacts, artifactRow{
44+ Name: "event.json",
45+ Size: formatFileSize(info.Size()),
46+ ModTime: formatTimestamp(fmt.Sprintf("%d", info.ModTime().Unix())),
47+ })
48+ }
49+
50+ // Add published.json if it exists
51+ publishedJSON := filepath.Join(jobDir, "published.json")
52+ if info, err := os.Stat(publishedJSON); err == nil {
53+ artifacts = append(artifacts, artifactRow{
54+ Name: "published.json",
55+ Size: formatFileSize(info.Size()),
56+ ModTime: formatTimestamp(fmt.Sprintf("%d", info.ModTime().Unix())),
57+ })
58 }
59
60+ // Skip zmx task artifacts (runner.html, runner.txt, etc.) — already in tasks table
61+
62 // Resolve overall job status
63 jobStatus := "success"
64 hasRunning := false