The accepted kind step (body StepRun: the pipeline, the branch, the source revision and each entry by module and fingerprint) and the event step-ended.<node> (StepEnded: the same entries, the outcome), as mesh-wants has for its composition step. Builds: design 47 G A-97 (§230, §194, §473) Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
227 lines
9.1 KiB
Go
227 lines
9.1 KiB
Go
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
|
|
|
|
// Package meshbuilds is the contract of the seat "mesh-builds", defined whole (seats/mesh-builds/seat.json): The builder's seat: it says each artifact it published and each agreed toolchain, and answers a module's reserved version. Held once for the mesh (design 47 G section 52, section 307).
|
|
package meshbuilds
|
|
|
|
import "time"
|
|
|
|
// Seat is the seat's name.
|
|
const Seat = "mesh-builds"
|
|
|
|
const (
|
|
VerbReserved = "reserved"
|
|
)
|
|
|
|
const (
|
|
AcceptStep = "step"
|
|
)
|
|
|
|
const (
|
|
EventPackagePublished = "package-published"
|
|
EventToolchainAgreed = "toolchain-agreed"
|
|
EventStepEnded = "step-ended"
|
|
)
|
|
|
|
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
|
|
func Verbs() []string {
|
|
return []string{VerbReserved}
|
|
}
|
|
|
|
// Events is every event published on the seat's subject: a new copy each call.
|
|
func Events() []string {
|
|
return []string{EventPackagePublished, EventToolchainAgreed, EventStepEnded}
|
|
}
|
|
|
|
// Family is where the seat's events are kept: the shared events stream, filtered to the seat's subjects.
|
|
const (
|
|
Family = "mesh-builds.events"
|
|
FamilyMaxAgeDays = 7
|
|
)
|
|
|
|
// StreamPackagePublished is the stream package-published is kept in.
|
|
const StreamPackagePublished = "SEAT_mesh-builds_package-published"
|
|
|
|
// SubjectPackagePublished is where package-published is published.
|
|
const SubjectPackagePublished = "mesh.seat.mesh-builds.event.package-published"
|
|
|
|
// StreamToolchainAgreed is the stream toolchain-agreed is kept in.
|
|
const StreamToolchainAgreed = "SEAT_mesh-builds_toolchain-agreed"
|
|
|
|
// SubjectToolchainAgreed is where toolchain-agreed is published.
|
|
const SubjectToolchainAgreed = "mesh.seat.mesh-builds.event.toolchain-agreed"
|
|
|
|
// StreamStepEnded is the stream step-ended is kept in.
|
|
const StreamStepEnded = "SEAT_mesh-builds_step-ended"
|
|
|
|
// SubjectStepEnded is where step-ended is published, on mesh.seat.mesh-builds.event.step-ended.<node>.
|
|
func SubjectStepEnded(node string) string { return "mesh.seat.mesh-builds.event.step-ended." + node }
|
|
|
|
// SubjectStepEndedAll hears every step-ended.
|
|
const SubjectStepEndedAll = "mesh.seat.mesh-builds.event.step-ended.*"
|
|
|
|
// AcceptSubjectStep is where step is sent.
|
|
const AcceptSubjectStep = "mesh.seat.mesh-builds.accept.step"
|
|
|
|
// BuildEntry is one entry a candidate's build builds: a module at the fingerprint of its build inputs, and the commit that fingerprint was read at.
|
|
type BuildEntry struct {
|
|
Commit string `json:"commit,omitempty"`
|
|
// the module's build-input fingerprint at the commit
|
|
Fingerprint string `json:"fingerprint"`
|
|
Module string `json:"module"`
|
|
}
|
|
|
|
// Dependency is a dependency the build resolved: one item of kind 1 for each resolved package and one of kind 3 for the toolchain, named by the build module in its step key and carried by the builder (design 47 G 374, 673).
|
|
type Dependency struct {
|
|
// the digest of the part, as the build used it
|
|
Digest string `json:"digest"`
|
|
// 1 an imported package, 3 the build toolchain (design 47 G section 374)
|
|
Kind int64 `json:"kind"`
|
|
// the dependency's part: for kind 1 the package's artifact reference, <module>:<artifact>; for kind 3 the agreed toolchain's part (design 47 G 466, 673)
|
|
Part string `json:"part"`
|
|
// the version of the dependency the build resolved
|
|
Version string `json:"version"`
|
|
}
|
|
|
|
// PackagePublished is one artifact published at the module's reserved version (design 47 G section 52, section 334).
|
|
type PackagePublished struct {
|
|
// the package's artifact reference, <module>:<artifact>, from the catalog entry
|
|
Artifact string `json:"artifact"`
|
|
At *time.Time `json:"at,omitempty"`
|
|
// the watched branch the build was made from
|
|
Branch string `json:"branch"`
|
|
// each dependency the build resolved, with its version and digest
|
|
Dependencies []Dependency `json:"dependencies,omitempty"`
|
|
// the published artifact's digest
|
|
Digest string `json:"digest"`
|
|
// the module
|
|
Module string `json:"module"`
|
|
// the source revision of that branch the build was made from
|
|
Source int64 `json:"source"`
|
|
V int64 `json:"v"`
|
|
// the version the build reserved, MAJOR.MINOR.PATCH
|
|
Version string `json:"version"`
|
|
}
|
|
|
|
// StepEnded is the build step's end, said by the builder on the node it runs on (design 47 G A-97; ADR 0666 section 21): the runner takes it only from that holder's account, naming the ask and each entry's fingerprint it was asked at.
|
|
type StepEnded struct {
|
|
// for a rerun, the caller the runtime proved
|
|
By string `json:"by,omitempty"`
|
|
Ended *time.Time `json:"ended,omitempty"`
|
|
// each entry the step built, by module and fingerprint
|
|
Entries []BuildEntry `json:"entries"`
|
|
// the ask's id
|
|
ID string `json:"id"`
|
|
// the node the builder ran it on, as in the subject
|
|
Node string `json:"node"`
|
|
// never passed for a build that built nothing
|
|
Outcome string `json:"outcome"`
|
|
Pipeline string `json:"pipeline"`
|
|
Rerun bool `json:"rerun,omitempty"`
|
|
// why it failed or could not run: the entry not built, the part not heard
|
|
Said string `json:"said,omitempty"`
|
|
Started *time.Time `json:"started,omitempty"`
|
|
Step string `json:"step"`
|
|
// the layout version
|
|
V int64 `json:"v,omitempty"`
|
|
}
|
|
|
|
// The values of StepEnded's outcome.
|
|
const (
|
|
StepEndedOutcomePassed = "passed"
|
|
StepEndedOutcomeFailed = "failed"
|
|
StepEndedOutcomeNothingToRun = "nothing to run"
|
|
StepEndedOutcomeCouldNotRun = "could not run"
|
|
)
|
|
|
|
// The values of StepEnded's step.
|
|
const (
|
|
StepEndedStepBuild = "build"
|
|
)
|
|
|
|
// StepRun is the build step of one module's pipeline (design 47 G section 230, A-97): the runner asks the seat mesh-builds to build a candidate's entries, each named by its fingerprint, and the builder, the one entry point for a candidate, takes the ask and answers the step's end.
|
|
type StepRun struct {
|
|
// the watched branch, or the branch of a run on request
|
|
Branch string `json:"branch"`
|
|
// for a rerun, the caller the runtime proved
|
|
By string `json:"by,omitempty"`
|
|
// each entry the candidate's build builds, by module and fingerprint
|
|
Entries []BuildEntry `json:"entries"`
|
|
// the runner's pipeline key, <branch>.<revision>.<module>, a branch escaped as a key's name is
|
|
Pipeline string `json:"pipeline"`
|
|
// the step is asked again by the runner's rerun
|
|
Rerun bool `json:"rerun,omitempty"`
|
|
// the catalog graph revision of the branch the pipeline runs for
|
|
Revision int64 `json:"revision,omitempty"`
|
|
// the source revision of the watched branch; absent for a run on request
|
|
Source int64 `json:"source,omitempty"`
|
|
Step string `json:"step"`
|
|
}
|
|
|
|
// The values of StepRun's step.
|
|
const (
|
|
StepRunStepBuild = "build"
|
|
)
|
|
|
|
// ToolchainAgreedDigestsItem is a type of the contract.
|
|
type ToolchainAgreedDigestsItem struct {
|
|
// the toolchain part's digest
|
|
Digest string `json:"digest"`
|
|
// the nodes reporting that digest
|
|
Nodes []string `json:"nodes"`
|
|
}
|
|
|
|
// ToolchainAgreed is the agreed toolchain of a language changed (design 47 G section 376, ADR 0584 section 1).
|
|
type ToolchainAgreed struct {
|
|
At *time.Time `json:"at,omitempty"`
|
|
// each digest the nodes reporting the agreed version report, as it stood when the version was agreed, with those nodes (design 47 G section 472, section 495)
|
|
Digests []ToolchainAgreedDigestsItem `json:"digests"`
|
|
// the language whose agreed toolchain changed
|
|
Language string `json:"language"`
|
|
V int64 `json:"v"`
|
|
// the agreed toolchain's version
|
|
Version string `json:"version"`
|
|
}
|
|
|
|
// ReservedInput is what reserved takes.
|
|
type ReservedInput struct {
|
|
// the module; give this or name
|
|
Module string `json:"module,omitempty"`
|
|
// a package's or an image's name in its ecosystem (the Go module path, the npm name, the image name), in place of module; a name no entry carries, or more than one entry carries, is answered error naming it (design 47 G section 478, section 491)
|
|
Name string `json:"name,omitempty"`
|
|
// the version, when asked for a particular one
|
|
Version string `json:"version,omitempty"`
|
|
}
|
|
|
|
// ReservedAnswerArtifactsItem is a type of the contract.
|
|
type ReservedAnswerArtifactsItem struct {
|
|
// the artifact reference, <module>:<artifact>
|
|
Artifact string `json:"artifact"`
|
|
// its digest once built; empty before
|
|
Digest string `json:"digest,omitempty"`
|
|
}
|
|
|
|
// ReservedAnswer is what reserved answers.
|
|
type ReservedAnswer struct {
|
|
Artifacts []ReservedAnswerArtifactsItem `json:"artifacts,omitempty"`
|
|
// a name no entry carries, or a version neither reserved nor released, naming which; set alone (design 47 G 582, 679)
|
|
Error string `json:"error,omitempty"`
|
|
// the module
|
|
Module string `json:"module,omitempty"`
|
|
// true when the version is released: the catalog holds it, and artifacts are the ones its release recorded with their digests; false when it is reserved (design 47 G 582, 679)
|
|
Released bool `json:"released,omitempty"`
|
|
// the reserved version, MAJOR.MINOR.PATCH
|
|
Version string `json:"version,omitempty"`
|
|
}
|
|
|
|
// StepAccept is the body of step.
|
|
type StepAccept = StepRun
|
|
|
|
// PackagePublishedEvent is the body of the event package-published.
|
|
type PackagePublishedEvent = PackagePublished
|
|
|
|
// ToolchainAgreedEvent is the body of the event toolchain-agreed.
|
|
type ToolchainAgreedEvent = ToolchainAgreed
|
|
|
|
// StepEndedEvent is the body of the event step-ended.
|
|
type StepEndedEvent = StepEnded
|