From d5266ca0097e4a0ae1d2a6ac21a8b042e840a07a Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Sun, 28 Jun 2026 08:46:17 +0200 Subject: [PATCH] hub v0.16.0: seed artifact manifest from env; manifests image -> 0.16.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - cmd/hub/main.go: seed the Day-0 artifact manifest from ARTIFACT_AGENT_VERSION/ ARTIFACT_AGENT_SHA256/ARTIFACT_GOLDEN_VERSION/ARTIFACT_GOLDEN_SHA256 on startup (only empty fields, so UI edits stick) — same escape hatch the floor uses. - manifests/hub.yaml: image 0.15.0 -> 0.16.0. Co-Authored-By: Claude Opus 4.8 (1M context) --- hub/CHANGELOG.md | 4 ++++ hub/cmd/hub/main.go | 41 +++++++++++++++++++++++++++++++++++++++++ manifests/hub.yaml | 2 +- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/hub/CHANGELOG.md b/hub/CHANGELOG.md index 51d55e2..47dc5ba 100644 --- a/hub/CHANGELOG.md +++ b/hub/CHANGELOG.md @@ -21,6 +21,10 @@ BUNDLE slice that lets a fresh PVE box self-install the agent (no more manual bi managed-update floor controls, with version + sha256 fields for each artifact. `POST /configs/artifacts` (CSRF-protected); versions validated as bare semver (reusing the floor validator), sha256s as 64-hex, blank-to-clear. +- **`main.go` (env seed):** seeds the manifest from `ARTIFACT_AGENT_VERSION` / `ARTIFACT_AGENT_SHA256` / + `ARTIFACT_GOLDEN_VERSION` / `ARTIFACT_GOLDEN_SHA256` on startup — but only fields the DB doesn't already + have, so a UI edit sticks across restarts. Same escape hatch the Phase-2 floor uses (the operator UI is + password-gated). - **Tests (`artifact_test.go`):** recorded set returned verbatim; unset → 200 empty; wrong/missing passphrase → 401; unknown customer → 404; store partial-set round-trip. Plus the floor-render smoke test updated for the new list-page data field. diff --git a/hub/cmd/hub/main.go b/hub/cmd/hub/main.go index e0f58b8..b7d0bcc 100644 --- a/hub/cmd/hub/main.go +++ b/hub/cmd/hub/main.go @@ -113,6 +113,47 @@ func main() { logger.Printf("[INFO] Default controller-version floor: %s", cfg.ControllerUpdates.DefaultMinVersion) } + // BUNDLE slice: seed the Day-0 artifact manifest from env (ARTIFACT_AGENT_VERSION / + // ARTIFACT_AGENT_SHA256 / ARTIFACT_GOLDEN_VERSION / ARTIFACT_GOLDEN_SHA256). The operator UI is the + // primary editor, but the UI is password-gated, so env-seeding is the same escape hatch the floor + // uses. Seed ONLY fields the DB doesn't already have, so a UI edit sticks across restarts and a + // fresh install still gets values from the deployment env. + { + m := dataStore.GetArtifactManifest() + changed := false + if m.AgentVersion == "" { + if v := os.Getenv("ARTIFACT_AGENT_VERSION"); v != "" { + m.AgentVersion = v + changed = true + } + } + if m.AgentSHA256 == "" { + if v := os.Getenv("ARTIFACT_AGENT_SHA256"); v != "" { + m.AgentSHA256 = v + changed = true + } + } + if m.GoldenVersion == "" { + if v := os.Getenv("ARTIFACT_GOLDEN_VERSION"); v != "" { + m.GoldenVersion = v + changed = true + } + } + if m.GoldenSHA256 == "" { + if v := os.Getenv("ARTIFACT_GOLDEN_SHA256"); v != "" { + m.GoldenSHA256 = v + changed = true + } + } + if changed { + if err := dataStore.SetArtifactManifest(m); err != nil { + logger.Printf("[WARN] Failed to seed artifact manifest from env: %v", err) + } else { + logger.Printf("[INFO] Artifact manifest seeded from env: agent=%s golden=%s", m.AgentVersion, m.GoldenVersion) + } + } + } + // Parse stale threshold staleThreshold, err := time.ParseDuration(cfg.Alerting.StaleThreshold) if err != nil { diff --git a/manifests/hub.yaml b/manifests/hub.yaml index fa50ee6..05d98b7 100644 --- a/manifests/hub.yaml +++ b/manifests/hub.yaml @@ -117,7 +117,7 @@ spec: spec: containers: - name: hub - image: gitea.dooplex.hu/admin/felhom-hub:0.15.0 + image: gitea.dooplex.hu/admin/felhom-hub:0.16.0 ports: - containerPort: 8080 name: http