From ca689073c48483f93bb6832b24e0587c9298b257 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 13 Sep 2026 01:05:40 +0200 Subject: [PATCH] A build says which machine made it, in the mesh's name for that machine An event whose origin reads a container id names something no other module can look up. The mesh already knows the answer, and a module's environment file is a file resource, so ${machine:name} reaches it with no composer change. --- cmd/mesh-builder/main.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cmd/mesh-builder/main.go b/cmd/mesh-builder/main.go index a419ef0..f35763c 100644 --- a/cmd/mesh-builder/main.go +++ b/cmd/mesh-builder/main.go @@ -82,9 +82,18 @@ func run() error { if workspace == "" { workspace = os.TempDir() + "/mesh-builder" } - on, err := os.Hostname() - if err != nil { - on = "a build machine" + // **The mesh's name for this machine, not the container's.** A build is reported to the rest + // of the mesh, and a report whose origin reads `104cb10e105b` names something no other module + // can look up. The mesh already knows the answer and has a way to say it — `${machine:name}` + // in the environment file this module is handed — so the hostname is only what is left when + // nobody said. + on := os.Getenv("MESH_NODE") + if on == "" { + hostname, err := os.Hostname() + if err != nil { + return fmt.Errorf("this build machine has no name: nothing said MESH_NODE and the host would not say either: %w", err) + } + on = hostname } ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)