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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user