A build says what it does on the bus, as it happens (novox/hq ADR 0157)
The build-machine seat emits `started` and `log.<build id>` beside `built`. Every line the builder speaks — each step, each command with its duration, and on failure the command's own output — goes to stderr as before and onto the bus under the build's id, one subject per build, kept a week in EVENTS with every other event. `builds --log <id>` reads it back from the stream with a consumer that is gone when the reading is done, on the command line and as the controller's seat verb; `builds` lists each build's id and `build` says the id it asked with. Lines are core publishes with a sequence number, so a build is not slowed by an ack per line and a gap is visible; `started` and `built` are awaited into the stream. The seat protocol widens additively at the controller's next start; the holder's grant follows on the broker node's next composition.
This commit is contained in:
@@ -27,6 +27,40 @@ const TheBuildMachine = "mesh-build-machine"
|
||||
func BuildWork() string { return "mesh.seat." + TheBuildMachine + ".accept.build" }
|
||||
func BuildOutcome() string { return "mesh.seat." + TheBuildMachine + ".event.built" }
|
||||
|
||||
// BuildStarted is where a build machine says it has taken a build, and BuildLog is where it says
|
||||
// what it is doing, one line per message, under the build's own id (novox/hq ADR 0157).
|
||||
//
|
||||
// **The whole build is on the bus as it happens.** The outcome alone told a person that a build
|
||||
// failed and its first line why; everything between — which command, how long, where it hung —
|
||||
// lived in one container's stderr on one machine. Every line is now an event of the role, retained
|
||||
// with the rest of the mesh's events, so a reader follows a build live by subscribing its subject,
|
||||
// or reads it back afterwards from the stream, and a viewer is a subscriber and nothing more.
|
||||
func BuildStarted() string { return "mesh.seat." + TheBuildMachine + ".event.started" }
|
||||
func BuildLog(id string) string { return "mesh.seat." + TheBuildMachine + ".event.log." + id }
|
||||
|
||||
// BuildStart is what a build machine says the moment it takes a build.
|
||||
type BuildStart struct {
|
||||
ID string `json:"id"`
|
||||
Repository string `json:"repository"`
|
||||
Path string `json:"path,omitempty"`
|
||||
Ref string `json:"ref,omitempty"`
|
||||
On string `json:"on"`
|
||||
At string `json:"at"`
|
||||
}
|
||||
|
||||
// BuildLine is one thing a build said while building.
|
||||
type BuildLine struct {
|
||||
ID string `json:"id"`
|
||||
// Seq counts the lines of one build from 1, so a reader that joined late or read two copies
|
||||
// can order them and see a gap.
|
||||
Seq int `json:"seq"`
|
||||
At string `json:"at"`
|
||||
// Step is which part of the build spoke — clone, context, image, run, failed — and Message is
|
||||
// what it said, as the builder's own log prints it.
|
||||
Step string `json:"step"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// KeyRoleBuilt is the build outcome under the role's name, on the bus the mesh runs on today.
|
||||
//
|
||||
// The same event as KeyModuleBuilt and published beside it, because a catalogue installed before this
|
||||
@@ -57,6 +91,13 @@ type BuildMachine interface {
|
||||
|
||||
// Build is one request a machine has been handed.
|
||||
type Build interface {
|
||||
// Began says the build has been taken and is under way, before anything runs.
|
||||
Began(ctx context.Context) error
|
||||
|
||||
// Say publishes one line of what the build is doing. Never fails the build: a line the bus
|
||||
// did not take is a line lost, and the outcome still comes.
|
||||
Say(step, message string)
|
||||
|
||||
// Request is what to build.
|
||||
Request() BuildRequest
|
||||
|
||||
|
||||
Reference in New Issue
Block a user