Build modules: give the puller the settings file and say a capacity of 0 in health (needs the mesh-sdk fix/park-wakes pin)
This commit is contained in:
@@ -91,9 +91,11 @@ func (m *Module) Puller(steps []StepTool, source buildstep.AskSource) *buildstep
|
|||||||
// nothing new.
|
// nothing new.
|
||||||
var cores func() float64
|
var cores func() float64
|
||||||
var hours func() (*buildstep.BuildWindow, string)
|
var hours func() (*buildstep.BuildWindow, string)
|
||||||
|
settings := ""
|
||||||
if capacity == nil {
|
if capacity == nil {
|
||||||
hours = buildstep.NodeBuildHours(m.Settings, m.Node, m.Say)
|
hours = buildstep.NodeBuildHours(m.Settings, m.Node, m.Say)
|
||||||
capacity = buildstep.NodeCapacity(m.Settings, m.Node, m.Say)
|
capacity = buildstep.NodeCapacity(m.Settings, m.Node, m.Say)
|
||||||
|
settings = m.Settings
|
||||||
watch = buildstep.WatchConfigServed
|
watch = buildstep.WatchConfigServed
|
||||||
cores = buildstep.NodeCoresPerStep(m.Settings, buildstep.DefaultCoresPerStep[delivery.AskGo], m.Say)
|
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,
|
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) {
|
Run: func(ctx context.Context, a delivery.StepAsk) (any, error) {
|
||||||
if err := m.Check(ctx); err != nil {
|
if err := m.Check(ctx); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -148,7 +148,17 @@ func (m *Module) Health(ctx context.Context) health.Answer {
|
|||||||
if err := m.room(); err != nil {
|
if err := m.room(); err != nil {
|
||||||
return health.Unhealthy(err.Error())
|
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
|
// 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
|
||||||
|
|||||||
@@ -47,9 +47,11 @@ func (m *Module) Puller(steps []StepTool, source buildstep.AskSource) *buildstep
|
|||||||
// nothing new.
|
// nothing new.
|
||||||
var cores func() float64
|
var cores func() float64
|
||||||
var hours func() (*buildstep.BuildWindow, string)
|
var hours func() (*buildstep.BuildWindow, string)
|
||||||
|
settings := ""
|
||||||
if capacity == nil {
|
if capacity == nil {
|
||||||
hours = buildstep.NodeBuildHours(m.Settings, m.Node, m.Say)
|
hours = buildstep.NodeBuildHours(m.Settings, m.Node, m.Say)
|
||||||
capacity = buildstep.NodeCapacity(m.Settings, m.Node, m.Say)
|
capacity = buildstep.NodeCapacity(m.Settings, m.Node, m.Say)
|
||||||
|
settings = m.Settings
|
||||||
watch = buildstep.WatchConfigServed
|
watch = buildstep.WatchConfigServed
|
||||||
cores = buildstep.NodeCoresPerStep(m.Settings, buildstep.DefaultCoresPerStep[delivery.AskImage], m.Say)
|
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) }
|
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,
|
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) {
|
Run: func(ctx context.Context, a delivery.StepAsk) (any, error) {
|
||||||
if err := m.Check(ctx); err != nil {
|
if err := m.Check(ctx); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -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.
|
// 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("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.
|
// Status is what the module reports of itself.
|
||||||
|
|||||||
@@ -55,9 +55,11 @@ func (m *Module) Puller(steps []StepTool, source buildstep.AskSource) *buildstep
|
|||||||
// nothing new.
|
// nothing new.
|
||||||
var cores func() float64
|
var cores func() float64
|
||||||
var hours func() (*buildstep.BuildWindow, string)
|
var hours func() (*buildstep.BuildWindow, string)
|
||||||
|
settings := ""
|
||||||
if capacity == nil {
|
if capacity == nil {
|
||||||
hours = buildstep.NodeBuildHours(m.Settings, m.Node, m.Say)
|
hours = buildstep.NodeBuildHours(m.Settings, m.Node, m.Say)
|
||||||
capacity = buildstep.NodeCapacity(m.Settings, m.Node, m.Say)
|
capacity = buildstep.NodeCapacity(m.Settings, m.Node, m.Say)
|
||||||
|
settings = m.Settings
|
||||||
watch = buildstep.WatchConfigServed
|
watch = buildstep.WatchConfigServed
|
||||||
cores = buildstep.NodeCoresPerStep(m.Settings, buildstep.DefaultCoresPerStep[delivery.AskNode], m.Say)
|
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) }
|
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,
|
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) {
|
Run: func(ctx context.Context, a delivery.StepAsk) (any, error) {
|
||||||
if err := m.Prepare(ctx); err != nil {
|
if err := m.Prepare(ctx); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -159,7 +159,17 @@ func (m *Module) Health(ctx context.Context) health.Answer {
|
|||||||
if err := m.room(); err != nil {
|
if err := m.room(); err != nil {
|
||||||
return health.Unhealthy(err.Error())
|
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
|
// 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
|
||||||
|
|||||||
Reference in New Issue
Block a user