chore(agent): add CHANGELOG, version the agent at 0.1.0
- CHANGELOG.md with the v0.1.0 (slice 1) entry - main: version var (0.1.0, ldflags-overridable) + --version flag; version shown in selftest header and startup log Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -22,17 +22,28 @@ import (
|
||||
"gitea.dooplex.hu/admin/felhom-agent/internal/proxmox"
|
||||
)
|
||||
|
||||
// version is the agent version. Overridable at build time with
|
||||
// -ldflags "-X main.version=<v>"; defaults to the in-repo CHANGELOG version.
|
||||
var version = "0.1.0"
|
||||
|
||||
func main() {
|
||||
var (
|
||||
cfgPath string
|
||||
selftest selftestFlag
|
||||
vmid int
|
||||
cfgPath string
|
||||
selftest selftestFlag
|
||||
vmid int
|
||||
showVersion bool
|
||||
)
|
||||
flag.StringVar(&cfgPath, "config", envOr("FELHOM_AGENT_CONFIG", "/etc/felhom-agent/agent.json"), "path to the agent config file (JSON)")
|
||||
flag.Var(&selftest, "selftest", "run a self-test and exit: bare/`read` = read-only queries; `task` = reversible mutating exercise (needs -vmid)")
|
||||
flag.IntVar(&vmid, "vmid", 0, "guest VMID for --selftest=task (the reversible snapshot/rollback exercise)")
|
||||
flag.BoolVar(&showVersion, "version", false, "print version and exit")
|
||||
flag.Parse()
|
||||
|
||||
if showVersion {
|
||||
fmt.Println("felhom-agent", version)
|
||||
return
|
||||
}
|
||||
|
||||
cfg, err := config.Load(cfgPath)
|
||||
if err != nil {
|
||||
// A missing default config file is fine if env provides the values; only a
|
||||
@@ -48,7 +59,8 @@ func main() {
|
||||
switch selftest.mode {
|
||||
case "":
|
||||
// No daemon loop yet.
|
||||
logger.Info("felhom-agent slice-1 scaffold; no run loop yet",
|
||||
logger.Info("felhom-agent scaffold; no run loop yet",
|
||||
"version", version,
|
||||
"hint", "use --selftest (read-only) or --selftest=task --vmid N")
|
||||
// TODO: poll loop — slice 3/4.
|
||||
return
|
||||
@@ -87,7 +99,7 @@ func runSelftestRead(ctx context.Context, cfg config.Config, logger *slog.Logger
|
||||
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
|
||||
defer cancel()
|
||||
|
||||
fmt.Println("=== felhom-agent selftest (read-only) ===")
|
||||
fmt.Printf("=== felhom-agent %s selftest (read-only) ===\n", version)
|
||||
fmt.Printf("endpoint : %s node=%s\n", cfg.Proxmox.Endpoint, cfg.Proxmox.Node)
|
||||
|
||||
fail := 0
|
||||
|
||||
Reference in New Issue
Block a user