Add versioned release builds for coordinator and worker

This commit is contained in:
Emil
2026-08-02 17:54:06 +03:00
parent 5665e7df98
commit f2977a990e
6 changed files with 159 additions and 3 deletions
+12
View File
@@ -2,6 +2,8 @@ package main
import (
"context"
"flag"
"fmt"
"log/slog"
"os"
"os/signal"
@@ -17,7 +19,17 @@ import (
"github.com/emil28092005/SciMesh/coordinator/internal/workloads"
)
// version is injected at build time (-ldflags "-X main.version=...") and
// reported by --version. "dev" marks a local build.
var version = "dev"
func main() {
showVersion := flag.Bool("version", false, "print the build version and exit")
flag.Parse()
if *showVersion {
fmt.Println("coordinator " + version)
return
}
// All work happens in run() so its defers (pool.Close, log flush, signal
// stop) still execute: os.Exit skips deferred calls entirely.
if err := run(); err != nil {
+12
View File
@@ -3,13 +3,25 @@
package main
import (
"flag"
"fmt"
"log/slog"
"os"
"github.com/emil28092005/SciMesh/coordinator/internal/agent"
)
// version is injected at build time (-ldflags "-X main.version=...") and
// reported by --version. "dev" marks a local build.
var version = "dev"
func main() {
showVersion := flag.Bool("version", false, "print the build version and exit")
flag.Parse()
if *showVersion {
fmt.Println("worker-agent " + version)
return
}
config, err := agent.LoadConfig()
if err != nil {
slog.Error("invalid configuration", "error", err)