Keep a recorded module at the build its machine runs on every send but a person's push, and say what a send recreates (hq issue 294, ADR 0242)
A plan's gated send for mail carried postgres's and mongodb's new builds (policy record) to the control node and the anchor on 2026-10-07: a send composes the machine's whole declaration from the builds the mesh holds, and the gate only ever looked at modules that roll out. Every send but a person's push now composes a recorded module from the manifest of the build the machine was last sent and records that it still carries it; the bus step moves the bus alone. And each move a gated send carries says how many of the module's containers it recreates, and whether with a new image or only their declaration.
This commit is contained in:
@@ -301,6 +301,7 @@ func gatedSend(ctx context.Context, open *stores, node string, owns []inventory.
|
||||
}
|
||||
}
|
||||
sort.Slice(moves, func(i, j int) bool { return moves[i].Module < moves[j].Module })
|
||||
sayRecreations(ctx, open, moves)
|
||||
sent, err := sendRollout(withScope(ctx, sendScope{judged: map[string]bool{node: true}}), open, []string{node})
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@@ -552,6 +553,9 @@ func advanceRelease(ctx context.Context, open *stores, p *inventory.Plan) (bool,
|
||||
}
|
||||
r.Gate = &inventory.PlanGate{Machines: sent, Since: &now, Carried: moves}
|
||||
p.Note = fmt.Sprintf("sent %s %d build(s) that waited for a gate; judging them there", node, len(moves))
|
||||
if said := recreationsSaid(moves); said != "" {
|
||||
p.Note += "; " + said
|
||||
}
|
||||
fmt.Printf("%s: %s\n", p.ID, p.Note)
|
||||
return true, nil
|
||||
}
|
||||
@@ -665,3 +669,38 @@ func backlogCommand(ctx context.Context, sub string, args []string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// sayRecreations says, on each move a send carries, what it does to the module's containers (novox/hq
|
||||
// ADR 0242): the build the machine ran against the one it is sent, container by container. Left unsaid
|
||||
// for a move whose earlier build is not in the records.
|
||||
func sayRecreations(ctx context.Context, open *stores, moves []inventory.CarriedMove) {
|
||||
if len(moves) == 0 {
|
||||
return
|
||||
}
|
||||
shelf, err := open.inventory.Catalogue(ctx)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for i, mv := range moves {
|
||||
to, held := shelf[mv.Module]
|
||||
if !held || mv.From == "" {
|
||||
continue
|
||||
}
|
||||
from, found, err := open.inventory.ManifestAt(ctx, mv.Module, mv.From)
|
||||
if err != nil || !found {
|
||||
continue
|
||||
}
|
||||
moves[i].Recreates = catalogue.Recreates(from, to).Say(mv.Module)
|
||||
}
|
||||
}
|
||||
|
||||
// recreationsSaid is every recreation a send's moves say, joined: what a plan's note carries.
|
||||
func recreationsSaid(moves []inventory.CarriedMove) string {
|
||||
var said []string
|
||||
for _, mv := range moves {
|
||||
if mv.Recreates != "" {
|
||||
said = append(said, fmt.Sprintf("on %s %s", mv.Node, mv.Recreates))
|
||||
}
|
||||
}
|
||||
return strings.Join(said, "; ")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user