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)