v0.291.0: decision 78 (R-726) — a returning household's first night sets the orphaned copy aside; R-838 — traefik v3.7.13, cloudflared 2026.9.3, filebrowser 1.5.6-stable, a release now moves a running file browser, check-infra-pins.py
gates / gates (push) Successful in 31s
gates / gates (push) Successful in 31s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"gitea.dooplex.hu/admin/felhom-controller/internal/dockerexec"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@@ -250,7 +251,7 @@ func changedInfraFiles(dir string, files map[string]infra.FileSpec) []string {
|
||||
|
||||
func (m *Manager) ensureFileBrowser(dir string) error {
|
||||
if containerRunning("filebrowser") {
|
||||
return nil
|
||||
return m.reconcileFileBrowserImage(dir)
|
||||
}
|
||||
composePath := filepath.Join(dir, "docker-compose.yml")
|
||||
if _, err := os.Stat(composePath); err == nil {
|
||||
@@ -411,3 +412,27 @@ func containerRunning(name string) bool {
|
||||
}
|
||||
return strings.TrimSpace(string(out)) == "true"
|
||||
}
|
||||
|
||||
var composeImageLine = regexp.MustCompile(`(?m)^(\s*image:\s*)(\S+)\s*$`)
|
||||
|
||||
// reconcileFileBrowserImage moves a RUNNING file browser to the pinned image (R-838, controller v0.291.0). Its compose
|
||||
// file is owned by web.SyncFileBrowserMounts (the storage mounts), which runs only when storage changes — so before
|
||||
// this, a release that raised FileBrowserImage never reached an installed box. Only the `image:` line is replaced;
|
||||
// the mounts stay byte-for-byte. Same image (or no compose file) → nothing. Pinned by TestReconcileFileBrowserImage_*.
|
||||
func (m *Manager) reconcileFileBrowserImage(dir string) error {
|
||||
composePath := filepath.Join(dir, "docker-compose.yml")
|
||||
cur, err := os.ReadFile(composePath)
|
||||
if err != nil {
|
||||
return nil // nothing provisioned by us here: leave it
|
||||
}
|
||||
mm := composeImageLine.FindSubmatch(cur)
|
||||
if mm == nil || string(mm[2]) == infra.FileBrowserImage {
|
||||
return nil
|
||||
}
|
||||
m.logger.Printf("[INFO] [infra] filebrowser runs %s, the pin is %s — moving it (mounts unchanged; the file browser pauses a few seconds)", mm[2], infra.FileBrowserImage)
|
||||
out := composeImageLine.ReplaceAll(cur, []byte("${1}"+infra.FileBrowserImage))
|
||||
if err := os.WriteFile(composePath, out, 0o644); err != nil {
|
||||
return fmt.Errorf("write docker-compose.yml: %w", err)
|
||||
}
|
||||
return m.composeUp(dir)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user