Commit 1569539
Eric Bower
·
2026-08-11 11:29:54 -0400 EDT
parent fe39804
fix: monitor fixes
1 files changed,
+13,
-4
M
main.go
M
main.go
+13,
-4
| ... | ... | @@ -1354,8 +1354,10 @@ func monitorTick(cfg *Cfg, log *slog.Logger, output io.Writer, jobStates map[str | |
| 1354 | 1354 | } | |
| 1355 | 1355 | publishedJSON, _ := json.Marshal(published) | |
| 1356 | 1356 | log.Info("writing sentinel", "path", sentinel) | |
| 1357 | - | if err := os.WriteFile(sentinel, publishedJSON, 0644); err != nil { | |
| 1358 | - | log.Error("write published sentinel", "err", err) | |
| 1357 | + | if err := os.MkdirAll(filepath.Dir(sentinel), 0755); err == nil { | |
| 1358 | + | if err := os.WriteFile(sentinel, publishedJSON, 0644); err != nil { | |
| 1359 | + | log.Error("write published sentinel", "err", err) | |
| 1360 | + | } | |
| 1359 | 1361 | } | |
| 1360 | 1362 | // Regenerate index.html now that published.json exists, so the artifact list includes it. | |
| 1361 | 1363 | indexHTML, indexTXT := generateJobIndex(cfg.ArtifactDir, name, jobID, group) |
| ... | ... | @@ -1709,8 +1711,15 @@ func publishStatus(w io.Writer, payload StatusPayload) error { | |
| 1709 | 1711 | if err != nil { | |
| 1710 | 1712 | return err | |
| 1711 | 1713 | } | |
| 1712 | - | _, err = w.Write(append(data, '\n')) | |
| 1713 | - | return err | |
| 1714 | + | if _, err := w.Write(append(data, '\n')); err != nil { | |
| 1715 | + | return err | |
| 1716 | + | } | |
| 1717 | + | if f, ok := w.(interface{ Flush() error }); ok { | |
| 1718 | + | _ = f.Flush() | |
| 1719 | + | } else if f, ok := w.(*os.File); ok { | |
| 1720 | + | _ = f.Sync() | |
| 1721 | + | } | |
| 1722 | + | return nil | |
| 1714 | 1723 | } | |
| 1715 | 1724 | ||
| 1716 | 1725 | func stageArtifact(dir, name, jobID, short, content, ext string) error { |