diff --git a/modules/mesh-build-go/cmd/mesh-build-go/asks.go b/modules/mesh-build-go/cmd/mesh-build-go/asks.go index 2c796c1c..ac6bac89 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/asks.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/asks.go @@ -91,9 +91,11 @@ func (m *Module) Puller(steps []StepTool, source buildstep.AskSource) *buildstep // nothing new. var cores func() float64 var hours func() (*buildstep.BuildWindow, string) + settings := "" if capacity == nil { hours = buildstep.NodeBuildHours(m.Settings, m.Node, m.Say) capacity = buildstep.NodeCapacity(m.Settings, m.Node, m.Say) + settings = m.Settings watch = buildstep.WatchConfigServed cores = buildstep.NodeCoresPerStep(m.Settings, buildstep.DefaultCoresPerStep[delivery.AskGo], m.Say) } @@ -106,7 +108,7 @@ func (m *Module) Puller(steps []StepTool, source buildstep.AskSource) *buildstep } } return &buildstep.Puller{Source: source, Language: delivery.AskGo, Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, - Capacity: capacity, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Logf: m.Say, Has: m.Has, + Capacity: capacity, SettingsFile: settings, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Logf: m.Say, Has: m.Has, Run: func(ctx context.Context, a delivery.StepAsk) (any, error) { if err := m.Check(ctx); err != nil { return nil, err diff --git a/modules/mesh-build-go/cmd/mesh-build-go/module.go b/modules/mesh-build-go/cmd/mesh-build-go/module.go index 7273eec6..3c9ea34c 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/module.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/module.go @@ -148,7 +148,17 @@ func (m *Module) Health(ctx context.Context) health.Answer { if err := m.room(); err != nil { return health.Unhealthy(err.Error()) } - return health.Healthy(fmt.Sprintf("%s installed, the version the module builds with (recipe %s)", installed, m.Recipe.Version())) + note := "" + if m.Held != nil { + why, fault := m.Held.CapacityNote() + if fault { + return health.Unhealthy(why) + } + if why != "" { + note = "; " + why // a capacity set to 0 is a choice, said so a starved builder is seen + } + } + return health.Healthy(fmt.Sprintf("%s installed, the version the module builds with (recipe %s)", installed, m.Recipe.Version()) + note) } // Long is a tool that runs a long step (ADR 0469 §2): it answers at once with the step's id, and the step ends on diff --git a/modules/mesh-build-image/cmd/mesh-build-image/asks.go b/modules/mesh-build-image/cmd/mesh-build-image/asks.go index 204123d6..909f750a 100644 --- a/modules/mesh-build-image/cmd/mesh-build-image/asks.go +++ b/modules/mesh-build-image/cmd/mesh-build-image/asks.go @@ -47,9 +47,11 @@ func (m *Module) Puller(steps []StepTool, source buildstep.AskSource) *buildstep // nothing new. var cores func() float64 var hours func() (*buildstep.BuildWindow, string) + settings := "" if capacity == nil { hours = buildstep.NodeBuildHours(m.Settings, m.Node, m.Say) capacity = buildstep.NodeCapacity(m.Settings, m.Node, m.Say) + settings = m.Settings watch = buildstep.WatchConfigServed cores = buildstep.NodeCoresPerStep(m.Settings, buildstep.DefaultCoresPerStep[delivery.AskImage], m.Say) } @@ -59,7 +61,7 @@ func (m *Module) Puller(steps []StepTool, source buildstep.AskSource) *buildstep load = func(key string) ([]byte, error) { return m.ReadPauses.Get(key) } } return &buildstep.Puller{Source: source, Language: delivery.AskImage, Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, - Capacity: capacity, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Eligible: m.Eligible, Logf: m.Say, + Capacity: capacity, SettingsFile: settings, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Eligible: m.Eligible, Logf: m.Say, Run: func(ctx context.Context, a delivery.StepAsk) (any, error) { if err := m.Check(ctx); err != nil { return nil, err diff --git a/modules/mesh-build-image/cmd/mesh-build-image/module.go b/modules/mesh-build-image/cmd/mesh-build-image/module.go index 4fb2a146..38b87d60 100644 --- a/modules/mesh-build-image/cmd/mesh-build-image/module.go +++ b/modules/mesh-build-image/cmd/mesh-build-image/module.go @@ -187,7 +187,17 @@ func (m *Module) Health(ctx context.Context) health.Answer { // Not eligible: the module runs, it takes no image ask here now, and says why; the capacity record says it too. return health.Healthy("not eligible to build images, so it takes no image ask: " + err.Error()) } - return health.Healthy(fmt.Sprintf("buildah %s installed; %s holds %d subordinate uids and %d gids; a user namespace can be made; %s opens", l.Buildah, l.Account, l.UIDs, l.GIDs, m.tunPath())) + note := "" + if m.Held != nil { + why, fault := m.Held.CapacityNote() + if fault { + return health.Unhealthy(why) + } + if why != "" { + note = "; " + why // a capacity set to 0 is a choice, said so a starved builder is seen + } + } + return health.Healthy(fmt.Sprintf("buildah %s installed; %s holds %d subordinate uids and %d gids; a user namespace can be made; %s opens", l.Buildah, l.Account, l.UIDs, l.GIDs, m.tunPath()) + note) } // Status is what the module reports of itself. diff --git a/modules/mesh-build-node/cmd/mesh-build-node/asks.go b/modules/mesh-build-node/cmd/mesh-build-node/asks.go index 2e8b26cf..bcb23ef4 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/asks.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/asks.go @@ -55,9 +55,11 @@ func (m *Module) Puller(steps []StepTool, source buildstep.AskSource) *buildstep // nothing new. var cores func() float64 var hours func() (*buildstep.BuildWindow, string) + settings := "" if capacity == nil { hours = buildstep.NodeBuildHours(m.Settings, m.Node, m.Say) capacity = buildstep.NodeCapacity(m.Settings, m.Node, m.Say) + settings = m.Settings watch = buildstep.WatchConfigServed cores = buildstep.NodeCoresPerStep(m.Settings, buildstep.DefaultCoresPerStep[delivery.AskNode], m.Say) } @@ -67,7 +69,7 @@ func (m *Module) Puller(steps []StepTool, source buildstep.AskSource) *buildstep load = func(key string) ([]byte, error) { return m.ReadPauses.Get(key) } } return &buildstep.Puller{Source: source, Language: delivery.AskNode, Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, - Capacity: capacity, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Logf: m.Say, + Capacity: capacity, SettingsFile: settings, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Logf: m.Say, Run: func(ctx context.Context, a delivery.StepAsk) (any, error) { if err := m.Prepare(ctx); err != nil { return nil, err diff --git a/modules/mesh-build-node/cmd/mesh-build-node/module.go b/modules/mesh-build-node/cmd/mesh-build-node/module.go index a6ec0aed..3bc5ec09 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/module.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/module.go @@ -159,7 +159,17 @@ func (m *Module) Health(ctx context.Context) health.Answer { if err := m.room(); err != nil { return health.Unhealthy(err.Error()) } - return health.Healthy(fmt.Sprintf("node %s installed, the version the module builds with (recipe %s)", installed, m.recipe().Version())) + note := "" + if m.Held != nil { + why, fault := m.Held.CapacityNote() + if fault { + return health.Unhealthy(why) + } + if why != "" { + note = "; " + why // a capacity set to 0 is a choice, said so a starved builder is seen + } + } + return health.Healthy(fmt.Sprintf("node %s installed, the version the module builds with (recipe %s)", installed, m.recipe().Version()) + note) } // Long is a tool that runs a long step (ADR 0469 §2): it answers at once with the step's id, and the step ends on