Commit 1450d68

Eric Bower  ·  2026-05-08 10:09:27 -0400 EDT
parent 15b8e8f
fix: html artifacts
1 files changed,  +32, -16
+32, -16
......@@ -1076,7 +1076,14 @@ func monitorTick(cfg *Cfg, log *slog.Logger, output io.Writer, jobStates map[str
10761076 }
10771077 }
10781078 // Write sentinel so we don't re-publish on subsequent ticks
1079- if err := os.WriteFile(sentinel, []byte(status), 0644); err != nil {
1079+ published := map[string]interface{}{
1080+ "status": status,
1081+ "exit_code": exitCode,
1082+ "job_id": jobID,
1083+ "finished_at": time.Now().UTC().Format(time.RFC3339),
1084+ }
1085+ publishedJSON, _ := json.Marshal(published)
1086+ if err := os.WriteFile(sentinel, publishedJSON, 0644); err != nil {
10801087 log.Error("write published sentinel", "err", err)
10811088 }
10821089 } else {
......@@ -1795,23 +1802,32 @@ func generateJobIndex(artifactDir, name, jobID string, sessions []SessionInfo) (
17951802 // Gather other artifacts in the job directory
17961803 var artifacts []artifactRow
17971804 jobDir := filepath.Join(artifactDir, name, jobID)
1798- if entries, err := os.ReadDir(jobDir); err == nil {
1799- for _, e := range entries {
1800- if e.IsDir() {
1801- continue // skip subdirs (task dirs)
1802- }
1803- info, err := e.Info()
1804- if err != nil {
1805- continue
1806- }
1807- artifacts = append(artifacts, artifactRow{
1808- Name: e.Name(),
1809- Size: formatFileSize(info.Size()),
1810- ModTime: formatTimestamp(fmt.Sprintf("%d", info.ModTime().Unix())),
1811- })
1812- }
1805+
1806+ // Always add workspace.tar (it's uploaded before pici runs)
1807+ artifacts = append(artifacts, artifactRow{Name: "workspace.tar", Size: "—", ModTime: "—"})
1808+
1809+ // Add event.json if it exists
1810+ eventJSON := filepath.Join(jobDir, "event.json")
1811+ if info, err := os.Stat(eventJSON); err == nil {
1812+ artifacts = append(artifacts, artifactRow{
1813+ Name: "event.json",
1814+ Size: formatFileSize(info.Size()),
1815+ ModTime: formatTimestamp(fmt.Sprintf("%d", info.ModTime().Unix())),
1816+ })
1817+ }
1818+
1819+ // Add published.json if it exists
1820+ publishedJSON := filepath.Join(jobDir, "published.json")
1821+ if info, err := os.Stat(publishedJSON); err == nil {
1822+ artifacts = append(artifacts, artifactRow{
1823+ Name: "published.json",
1824+ Size: formatFileSize(info.Size()),
1825+ ModTime: formatTimestamp(fmt.Sprintf("%d", info.ModTime().Unix())),
1826+ })
18131827 }
18141828
1829+ // Skip zmx task artifacts (runner.html, runner.txt, etc.) — already in tasks table
1830+
18151831 // Resolve overall job status
18161832 jobStatus := "success"
18171833 hasRunning := false