Merge pull request 'The controller composes one tool runtime per node: its principal, the bundles, its process, and the gate (hq ADR 0175, to-be 38 WP2)' (#223) from feat/the-operators-machine into main
This commit was merged in pull request #223.
This commit is contained in:
@@ -572,6 +572,36 @@ type Manifest struct {
|
||||
// a module that could ask for it could read every credential on the bus — and the claim on
|
||||
// `mesh-broker` is what authorises it, checked from this manifest alone.
|
||||
BusUsers string `json:"bus-users,omitempty"`
|
||||
|
||||
// Bundles are this module's compiled bundles as the build produced them: what each is called,
|
||||
// where it is, what it hashes to, what language it is in and which files a tool runtime loads
|
||||
// from it (novox/hq ADR 0175, to-be 38).
|
||||
//
|
||||
// **Derived, never written.** The manifest in a repository says `build.artifacts`; the manifest
|
||||
// the mesh holds says what came out, the way a resource naming an artifact comes to name a
|
||||
// digest. Kept here because a tools bundle is referenced by no resource of the module's own —
|
||||
// the node's runtime loads it, and the runtime is composed by the mesh — so without this the
|
||||
// resolved manifest would carry no trace of the one artifact the runtime needs. A repository
|
||||
// manifest that writes this beside a build is refused: it would be stating the build's output
|
||||
// by hand.
|
||||
Bundles []Bundle `json:"bundles,omitempty"`
|
||||
}
|
||||
|
||||
// Bundle is one compiled bundle after it exists, as the resolved manifest carries it.
|
||||
type Bundle struct {
|
||||
Name string `json:"name"`
|
||||
// Source is where a machine fetches it, kept without the store's address like every reference
|
||||
// the mesh records (artifacts.go); Digest is what it must hash to.
|
||||
Source string `json:"source"`
|
||||
Digest string `json:"digest"`
|
||||
// Language is what it was compiled from, which is what says how it is run.
|
||||
Language string `json:"language,omitempty"`
|
||||
// Entrypoints are the compiled files it was built around, relative to its root.
|
||||
Entrypoints []string `json:"entrypoints,omitempty"`
|
||||
// Loads are the entrypoints a node's tool runtime imports from it: what the artifact said, or
|
||||
// every entrypoint for a module declaring tools that said nothing. Empty for a bundle that is
|
||||
// run rather than loaded.
|
||||
Loads []string `json:"loads,omitempty"`
|
||||
}
|
||||
|
||||
// Build says how to produce this module's artifacts from its source.
|
||||
@@ -708,6 +738,16 @@ type Artifact struct {
|
||||
// somebody adds a helper. An empty list is a bundle that is run rather than loaded — a
|
||||
// provisioner or a step, named by whatever runs it.
|
||||
Entrypoints []string `json:"entrypoints,omitempty"`
|
||||
|
||||
// Loads are the entrypoints of this bundle the node's tool runtime loads (novox/hq ADR 0175,
|
||||
// to-be 38): the module's tool code, each file registering its tools as it is imported. A
|
||||
// subset of Entrypoints, for a bundle that also carries things that are RUN — a daemon, a
|
||||
// step, a report — and must not have them imported into the runtime.
|
||||
//
|
||||
// Absent means every entrypoint, for a module that declares `tools`: a bundle holding the
|
||||
// module's tools and nothing else is the ordinary case and should not have to say the same
|
||||
// list twice. A module declaring no tools has nothing the runtime loads, whatever it compiles.
|
||||
Loads []string `json:"loads,omitempty"`
|
||||
}
|
||||
|
||||
// Kinds an artifact may be.
|
||||
@@ -1333,6 +1373,15 @@ func ParseManifest(raw []byte) (Manifest, error) {
|
||||
//
|
||||
// Refused here because the alternative is a build that never returns, on a mesh new enough
|
||||
// that nobody is watching it yet.
|
||||
if m.Build != nil && len(m.Bundles) > 0 {
|
||||
// The output of a build, written beside the build that produces it (ADR 0175). A resource
|
||||
// naming a digest beside an `artifact` would be the same mistake, and is caught the same way:
|
||||
// what the mesh derives, a repository does not state.
|
||||
problems = append(problems, fmt.Sprintf(
|
||||
"%s writes `bundles` beside its build. The mesh derives that from what the build "+
|
||||
"produced; a manifest states `build.artifacts` and nothing about what came out",
|
||||
m.Module))
|
||||
}
|
||||
if m.Build != nil && len(m.Build.Artifacts) > 0 {
|
||||
for _, o := range m.Offers() {
|
||||
if o != ArtifactStoreProvision {
|
||||
|
||||
Reference in New Issue
Block a user