Builders, the artifact store's tools and distribution read and write the registry reference form through the registry clients' reference package, and name the sweep seat from its contract (ADR 0634 §4, S-8; issue 1966)

catalogue's SeatReference, InRegistrySeat, Routed, Recorded, InArtifactStore and ArtifactSweepSeat leave mesh-sdk;
each package gives the two registry seats' names from their contracts (or the build step's copies of them).

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
2026-11-05 17:26:32 +01:00
parent 2978dd5bed
commit 82d00aeb5e
17 changed files with 63 additions and 38 deletions
@@ -32,8 +32,8 @@ import (
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient" "git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient"
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient" "git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient"
meshconditions "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions" meshconditions "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions"
artifactref "git.novox.be/novox/mesh-delivery/contracts/go/clients/containerimageregistryclient/reference"
stdio "git.novox.be/novox/mesh-sdk/go" stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/views" "git.novox.be/novox/mesh-sdk/go/views"
) )
@@ -220,8 +220,8 @@ func KeepSet(builds []Build, wants []Want) map[string]*Ref {
out := map[string]*Ref{} out := map[string]*Ref{}
for _, b := range builds { for _, b := range builds {
for _, a := range b.Artifacts { for _, a := range b.Artifacts {
reference := canonical(catalogue.Recorded(a.Reference)) reference := canonical(registryForms.Recorded(a.Reference))
if _, ours := catalogue.InArtifactStore(reference); !ours || a.Kind == "package" { if _, ours := registryForms.InArtifactStore(reference); !ours || a.Kind == "package" {
continue continue
} }
r := out[reference] r := out[reference]
@@ -386,7 +386,7 @@ func Mirrors(v *View, builds []Build, kept map[string][]string, against map[stri
continue continue
} }
for d := range v.L.Repos[name].Revisions { for d := range v.L.Repos[name].Revisions {
r := catalogue.ArtifactStoreScheme + name + "@" + d r := artifactref.ArtifactStoreScheme + name + "@" + d
out[r] = &Ref{Reference: r, Kind: "image"} out[r] = &Ref{Reference: r, Kind: "image"}
} }
} }
@@ -400,7 +400,7 @@ func Mirrors(v *View, builds []Build, kept map[string][]string, against map[stri
continue continue
} }
for _, base := range bases { for _, base := range bases {
if m := out[catalogue.Recorded(base)]; m != nil { if m := out[registryForms.Recorded(base)]; m != nil {
m.Builds = append(m.Builds, b) m.Builds = append(m.Builds, b)
why := kept[b.Key] why := kept[b.Key]
if len(why) > 0 { if len(why) > 0 {
@@ -448,7 +448,7 @@ func (j *judged) records(repository string, collected bool) *Records {
} }
} }
r.Counts[state]++ r.Counts[state]++
if (repository != "" && !strings.HasPrefix(strings.TrimPrefix(ref.Reference, catalogue.ArtifactStoreScheme), repository)) || if (repository != "" && !strings.HasPrefix(strings.TrimPrefix(ref.Reference, artifactref.ArtifactStoreScheme), repository)) ||
(state == "collected" && !collected) { (state == "collected" && !collected) {
continue continue
} }
@@ -650,7 +650,7 @@ func (h *Holder) sayGone(j *judged, refs []string, how string) {
// artifacts-gone against its own key. // artifacts-gone against its own key.
func namedBy(b Build, r string) string { func namedBy(b Build, r string) string {
for _, a := range b.Artifacts { for _, a := range b.Artifacts {
if rec := catalogue.Recorded(a.Reference); canonical(rec) == r { if rec := registryForms.Recorded(a.Reference); canonical(rec) == r {
return rec return rec
} }
} }
@@ -678,7 +678,7 @@ func (h *Holder) Held(refs []string) (HeldAnswer, error) {
return HeldAnswer{}, fmt.Errorf("held judges at most 64 references at once, and %d were given", len(refs)) return HeldAnswer{}, fmt.Errorf("held judges at most 64 references at once, and %d were given", len(refs))
} }
for _, r := range refs { for _, r := range refs {
if _, ours := catalogue.InArtifactStore(r); !ours { if _, ours := registryForms.InArtifactStore(r); !ours {
return HeldAnswer{}, fmt.Errorf("%s is not a reference into the mesh's artifact store (artifact-store://...): nothing was asked", r) return HeldAnswer{}, fmt.Errorf("%s is not a reference into the mesh's artifact store (artifact-store://...): nothing was asked", r)
} }
} }
@@ -744,7 +744,7 @@ func (h *Holder) ImagesOf(node string, address string) (Images, error) {
images := []string{} images := []string{}
for _, a := range b.Artifacts { for _, a := range b.Artifacts {
if (a.Kind == "image" || a.Kind == "upstream") && a.Reference != "" { if (a.Kind == "image" || a.Kind == "upstream") && a.Reference != "" {
images = append(images, catalogue.Routed(catalogue.Recorded(a.Reference), address)) images = append(images, registryForms.Routed(registryForms.Recorded(a.Reference), address))
} }
} }
pinned, err := h.Pinned(b.Manifest) pinned, err := h.Pinned(b.Manifest)
@@ -845,8 +845,8 @@ func inStoreAt(image, address string) string {
if address == "" || !strings.HasPrefix(image, address+"/") || !strings.Contains(image, "@sha256:") { if address == "" || !strings.HasPrefix(image, address+"/") || !strings.Contains(image, "@sha256:") {
return "" return ""
} }
r := catalogue.Recorded(image) r := registryForms.Recorded(image)
if _, ours := catalogue.InArtifactStore(r); !ours { if _, ours := registryForms.InArtifactStore(r); !ours {
return "" return ""
} }
return r return r
@@ -879,7 +879,7 @@ func (h *Holder) Observe(ctx context.Context) error {
var refs []string var refs []string
for _, a := range b.Artifacts { for _, a := range b.Artifacts {
if a.Kind == "image" { if a.Kind == "image" {
refs = append(refs, catalogue.Recorded(a.Reference)) refs = append(refs, registryForms.Recorded(a.Reference))
} }
} }
// And what its manifest pins by itself under the store's address, as the controller judged S25. // And what its manifest pins by itself under the store's address, as the controller judged S25.
@@ -22,7 +22,9 @@ import (
meshconditions "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions" meshconditions "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions"
stdio "git.novox.be/novox/mesh-sdk/go" stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/catalogue" artifactref "git.novox.be/novox/mesh-delivery/contracts/go/clients/containerimageregistryclient/reference"
reg "git.novox.be/novox/mesh-delivery/contracts/go/seats/containerimageregistry"
ociseat "git.novox.be/novox/mesh-delivery/contracts/go/seats/ociartifactregistry"
) )
// memBus is the holder's bus in memory: states by name, each key's history, and what was published. // memBus is the holder's bus in memory: states by name, each key's history, and what was published.
@@ -110,9 +112,9 @@ func (d *memDoor) seat(key string, body any) (json.RawMessage, error) {
var in struct{ Name, Digest, Reason string } var in struct{ Name, Digest, Reason string }
_ = json.Unmarshal(raw, &in) _ = json.Unmarshal(raw, &in)
seat, verb, _ := strings.Cut(strings.TrimPrefix(key, "seat:"), ".") seat, verb, _ := strings.Cut(strings.TrimPrefix(key, "seat:"), ".")
ref := catalogue.ArtifactStoreScheme + in.Name + "@" + in.Digest ref := artifactref.ArtifactStoreScheme + in.Name + "@" + in.Digest
if seat == "oci-artifact-registry" { if seat == "oci-artifact-registry" {
ref = catalogue.ArtifactStoreScheme + in.Name + "/blobs/" + in.Digest ref = artifactref.ArtifactStoreScheme + in.Name + "/blobs/" + in.Digest
} }
d.calls = append(d.calls, key+" "+in.Name+"@"+in.Digest+" "+in.Reason) d.calls = append(d.calls, key+" "+in.Name+"@"+in.Digest+" "+in.Reason)
if err := d.refuse[verb+" "+ref]; err != nil { if err := d.refuse[verb+" "+ref]; err != nil {
@@ -308,8 +310,8 @@ func TestTheSeatKeepsTheFiveNewestAndTheWantedAndSweepsWithNoLease(t *testing.T)
for _, n := range []int{2, 3} { for _, n := range []int{2, 3} {
key, _ := builds.BuilderBuildKey("letta", fp(n)) key, _ := builds.BuilderBuildKey("letta", fp(n))
raw, _ := builds.EncodeBuilderBuild(builds.BuilderBuild{State: builds.BuildDone, Manifest: strings.Repeat("d", 64), Artifacts: []builds.BuiltArtifact{ raw, _ := builds.EncodeBuilderBuild(builds.BuilderBuild{State: builds.BuildDone, Manifest: strings.Repeat("d", 64), Artifacts: []builds.BuiltArtifact{
{Name: "image", Kind: "image", Digest: digestOf(imageRef("letta", n)), Reference: catalogue.SeatReference("container-image-registry", "letta", "image", digestOf(imageRef("letta", n)))}, {Name: "image", Kind: "image", Digest: digestOf(imageRef("letta", n)), Reference: artifactref.SeatReference(reg.Seat, "letta", "image", digestOf(imageRef("letta", n)))},
{Name: "files", Kind: "archive", Digest: digestOf(archiveRef("letta", n)), Reference: catalogue.SeatReference("oci-artifact-registry", "letta", "files", digestOf(archiveRef("letta", n)))}}}) {Name: "files", Kind: "archive", Digest: digestOf(archiveRef("letta", n)), Reference: artifactref.SeatReference(ociseat.Seat, "letta", "files", digestOf(archiveRef("letta", n)))}}})
_ = b.Put(BuildsRead, key, json.RawMessage(raw)) _ = b.Put(BuildsRead, key, json.RawMessage(raw))
} }
} }
@@ -1,6 +1,6 @@
package main package main
// The seat mesh-artifact-sweep's verbs (novox/hq ADR 0571 clause 2; catalogue.ArtifactSweepSeat), each a tool named // The seat mesh-artifact-sweep's verbs (novox/hq ADR 0571 clause 2; sweep.Seat), each a tool named
// `artifact-store.<verb>` as the runtime serves a seat's verb, answering as the controller's verb answered: {output, // `artifact-store.<verb>` as the runtime serves a seat's verb, answering as the controller's verb answered: {output,
// ok, answer}. // ok, answer}.
@@ -8,8 +8,8 @@ import (
"fmt" "fmt"
"strings" "strings"
sweep "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshartifactsweep"
stdio "git.novox.be/novox/mesh-sdk/go" stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/catalogue"
) )
// verbAnswer is the controller's verbs' answer shape, which the builder and docker read (answerOf). // verbAnswer is the controller's verbs' answer shape, which the builder and docker read (answerOf).
@@ -21,7 +21,7 @@ type verbAnswer struct {
// SeatTools are the seat's verbs over h; s reads the store's listing for mirrors. // SeatTools are the seat's verbs over h; s reads the store's listing for mirrors.
func SeatTools(h *Holder, s *Store) []stdio.Tool { func SeatTools(h *Holder, s *Store) []stdio.Tool {
seat := catalogue.ArtifactSweepSeat + "." seat := sweep.Seat + "."
return []stdio.Tool{ return []stdio.Tool{
{Name: seat + "artifacts", Description: "Every artifact the mesh made that the store holds: kept and why, eligible, " + {Name: seat + "artifacts", Description: "Every artifact the mesh made that the store holds: kept and why, eligible, " +
"or with collected those it no longer holds.", "or with collected those it no longer holds.",
@@ -2,6 +2,7 @@ package main
import ( import (
reg "git.novox.be/novox/mesh-delivery/contracts/go/seats/containerimageregistry" reg "git.novox.be/novox/mesh-delivery/contracts/go/seats/containerimageregistry"
sweep "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshartifactsweep"
"git.novox.be/novox/mesh-sdk/go/catalogue" "git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-sdk/go/seatlist/seatlisttest" "git.novox.be/novox/mesh-sdk/go/seatlist/seatlisttest"
"git.novox.be/novox/mesh-sdk/go/views" "git.novox.be/novox/mesh-sdk/go/views"
@@ -489,15 +490,15 @@ func TestTheToolsServedAreTheToolsTheManifestNames(t *testing.T) {
} }
var verbs []string var verbs []string
for _, tl := range SeatTools(&Holder{}, &Store{}) { for _, tl := range SeatTools(&Holder{}, &Store{}) {
verbs = append(verbs, strings.TrimPrefix(tl.Name, catalogue.ArtifactSweepSeat+".")) verbs = append(verbs, strings.TrimPrefix(tl.Name, sweep.Seat+"."))
} }
catalogue.UseSeats(catalogue.SeatsFromDefinitions(seatlisttest.Definitions())) catalogue.UseSeats(catalogue.SeatsFromDefinitions(seatlisttest.Definitions()))
seat, _ := catalogue.SeatNamed(catalogue.ArtifactSweepSeat) seat, _ := catalogue.SeatNamed(sweep.Seat)
var contract []string var contract []string
for _, v := range seat.Serves { for _, v := range seat.Serves {
contract = append(contract, v.Name) contract = append(contract, v.Name)
} }
if len(m.Claims) != 1 || m.Claims[0].Name != catalogue.ArtifactSweepSeat || !reflect.DeepEqual(m.Claims[0].Serves, verbs) || if len(m.Claims) != 1 || m.Claims[0].Name != sweep.Seat || !reflect.DeepEqual(m.Claims[0].Serves, verbs) ||
!reflect.DeepEqual(verbs, contract) { !reflect.DeepEqual(verbs, contract) {
t.Errorf("claims %+v, serves %v, the seat's verbs %v", m.Claims, verbs, contract) t.Errorf("claims %+v, serves %v, the seat's verbs %v", m.Claims, verbs, contract)
} }
@@ -16,6 +16,7 @@ import (
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient" "git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient"
meshconditions "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions" meshconditions "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions"
artifactref "git.novox.be/novox/mesh-delivery/contracts/go/clients/containerimageregistryclient/reference"
ociseat "git.novox.be/novox/mesh-delivery/contracts/go/seats/ociartifactregistry" ociseat "git.novox.be/novox/mesh-delivery/contracts/go/seats/ociartifactregistry"
"git.novox.be/novox/mesh-sdk/go/catalogue" "git.novox.be/novox/mesh-sdk/go/catalogue"
@@ -146,3 +147,7 @@ func keptWhy(r *Ref) string {
} }
return "kept: " + strings.Join(r.Why, "; ") return "kept: " + strings.Join(r.Why, "; ")
} }
// registryForms reads and routes a reference of the registry form, with the two registry seats' names from their contracts
// (the registry clients' reference forms, novox/hq ADR 0605 §9, ADR 0634 §4).
var registryForms = artifactref.Seats{Image: reg.Seat, Object: ociseat.Seat}
+1
View File
@@ -3,6 +3,7 @@ module artifactstoretools
go 1.26.0 go 1.26.0
require ( require (
git.novox.be/novox/mesh-delivery/contracts/go/clients/containerimageregistryclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/contracts/go/seats/meshartifactsweep v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-delivery/contracts/go/seats/meshartifactsweep v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-contracts/placement/go/seats/meshwants v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-contracts/placement/go/seats/meshwants v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-contracts/go/seats/nodeengine v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-contracts/go/seats/nodeengine v0.0.0-00010101000000-000000000000
+1
View File
@@ -3,6 +3,7 @@ module distribution
go 1.26.0 go 1.26.0
require ( require (
git.novox.be/novox/mesh-delivery/contracts/go/clients/containerimageregistryclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/sdk v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-delivery/sdk v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient v0.0.0-00010101000000-000000000000
@@ -17,7 +17,7 @@ import (
"time" "time"
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient" "git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient"
"git.novox.be/novox/mesh-sdk/go/catalogue" artifactref "git.novox.be/novox/mesh-delivery/contracts/go/clients/containerimageregistryclient/reference"
) )
type memObjects map[string][]byte type memObjects map[string][]byte
@@ -251,7 +251,7 @@ func TestTheHolderOfTheTwoImageSeats(t *testing.T) {
} }
// The reference's registry part is the seat's name, as a node-engine reads it back (ADR 0605 §9); nothing set on // The reference's registry part is the seat's name, as a node-engine reads it back (ADR 0605 §9); nothing set on
// the process names a reach. // the process names a reach.
if seat, path, ok := catalogue.InRegistrySeat(b.said[0].body.Reference); !ok || seat != ArtifactSeat || path != "m/program@"+part.Digest { if seat, path, ok := registryForms.InRegistrySeat(b.said[0].body.Reference); !ok || seat != ArtifactSeat || path != "m/program@"+part.Digest {
t.Errorf("the published reference %q is not the seat's form", b.said[0].body.Reference) t.Errorf("the published reference %q is not the seat's form", b.said[0].body.Reference)
} }
if len(b.h.Objects.(memObjects)) != 0 || len(b.h.Transfers.(memTransfers)) != 0 { if len(b.h.Objects.(memObjects)) != 0 || len(b.h.Transfers.(memTransfers)) != 0 {
@@ -910,3 +910,6 @@ func TestTheHolderOfTheTwoImageSeats(t *testing.T) {
} }
}) })
} }
// registryForms reads a reference of the registry form, with the two seats' names this holder answers for.
var registryForms = artifactref.Seats{Image: ImageSeat, Object: ArtifactSeat}
@@ -146,7 +146,7 @@ type Store interface {
} }
// SeatReference is a reference in the form the seat answers (novox/hq ADR 0605 §9): the seat's name, then the path the // SeatReference is a reference in the form the seat answers (novox/hq ADR 0605 §9): the seat's name, then the path the
// store answers (`<name>@sha256:<digest>`), as catalogue.InRegistrySeat reads it back. Nothing set on the process names // store answers (`<name>@sha256:<digest>`), as the registry clients' reference.Seats.InRegistrySeat reads it back. Nothing set on the process names
// a reach: the seat's name is the registry part. // a reach: the seat's name is the registry part.
func SeatReference(seat, path string) string { return seat + "/" + path } func SeatReference(seat, path string) string { return seat + "/" + path }
@@ -14,6 +14,7 @@ import (
"strings" "strings"
"git.novox.be/novox/mesh-catalog/modules/mesh-build-go/buildstep" "git.novox.be/novox/mesh-catalog/modules/mesh-build-go/buildstep"
artifactref "git.novox.be/novox/mesh-delivery/contracts/go/clients/containerimageregistryclient/reference"
builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds" builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"git.novox.be/novox/mesh-sdk/go/catalogue" "git.novox.be/novox/mesh-sdk/go/catalogue"
) )
@@ -179,7 +180,7 @@ func (m *Module) packInto(ctx context.Context, workspace, module, name, artifact
if err := m.publishArchive(ctx, name, artifact, kind, digest, archive); err != nil { if err := m.publishArchive(ctx, name, artifact, kind, digest, archive); err != nil {
return BuildResult{}, fmt.Errorf("%s%s: %v", builds.NotStored, artifact, err) return BuildResult{}, fmt.Errorf("%s%s: %v", builds.NotStored, artifact, err)
} }
return BuildResult{Artifact: artifact, Digest: digest, Size: len(archive), Reference: catalogue.SeatReference(ArtifactSeat, name, artifact, digest)}, nil return BuildResult{Artifact: artifact, Digest: digest, Size: len(archive), Reference: artifactref.SeatReference(ArtifactSeat, name, artifact, digest)}, nil
} }
// buildEnv is the environment of the compile: the build agent's (CGO_ENABLED=0, GOFLAGS) with the installed go // buildEnv is the environment of the compile: the build agent's (CGO_ENABLED=0, GOFLAGS) with the installed go
@@ -23,9 +23,10 @@ import (
"github.com/distribution/distribution/v3/registry/handlers" "github.com/distribution/distribution/v3/registry/handlers"
_ "github.com/distribution/distribution/v3/registry/storage/driver/inmemory" _ "github.com/distribution/distribution/v3/registry/storage/driver/inmemory"
"git.novox.be/novox/mesh-catalog/modules/mesh-build-go/buildstep"
artifactref "git.novox.be/novox/mesh-delivery/contracts/go/clients/containerimageregistryclient/reference"
registry "git.novox.be/novox/mesh-delivery/contracts/go/seats/containerimageregistry" registry "git.novox.be/novox/mesh-delivery/contracts/go/seats/containerimageregistry"
builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds" builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"git.novox.be/novox/mesh-sdk/go/catalogue"
) )
// realStore starts the artifact store's own program (the distribution registry, modules/distribution) inside this // realStore starts the artifact store's own program (the distribution registry, modules/distribution) inside this
@@ -94,14 +95,14 @@ func uploadBlob(base, name, digest string, body []byte) error {
return nil return nil
} }
// resolve reads a done artifact's reference from the store as a node-engine does (catalogue.Routed): the seat's form // resolve reads a done artifact's reference from the store as a node-engine does (registryForms.Routed): the seat's form
// oci-artifact-registry/<module>/<artifact>@<digest> is <store>/v2/<module>/<artifact>/blobs/<digest> (ADR 0605 §9). // oci-artifact-registry/<module>/<artifact>@<digest> is <store>/v2/<module>/<artifact>/blobs/<digest> (ADR 0605 §9).
func resolve(t *testing.T, addr string, a builds.BuiltArtifact) []byte { func resolve(t *testing.T, addr string, a builds.BuiltArtifact) []byte {
t.Helper() t.Helper()
if _, _, ok := catalogue.InRegistrySeat(a.Reference); !ok { if _, _, ok := registryForms.InRegistrySeat(a.Reference); !ok {
t.Fatalf("%s's reference %q is not in the form a registry seat answers", a.Name, a.Reference) t.Fatalf("%s's reference %q is not in the form a registry seat answers", a.Name, a.Reference)
} }
resp, err := http.Get(catalogue.Routed(a.Reference, addr)) resp, err := http.Get(registryForms.Routed(a.Reference, addr))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -161,3 +162,6 @@ func TestADoneBuildsArtifactsResolveInARealArtifactStore(t *testing.T) {
} }
} }
} }
// registryForms reads a reference of the registry form, the two seats' names from the build step (their contracts).
var registryForms = artifactref.Seats{Image: buildstep.ImageSeat, Object: buildstep.ArtifactSeat}
+1
View File
@@ -3,6 +3,7 @@ module meshbuildgo
go 1.26.0 go 1.26.0
require ( require (
git.novox.be/novox/mesh-delivery/contracts/go/clients/containerimageregistryclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/contracts/go/clients/meshcatalogclient v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-delivery/contracts/go/clients/meshcatalogclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds v0.0.0-00010101000000-000000000000
@@ -16,9 +16,9 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
artifactref "git.novox.be/novox/mesh-delivery/contracts/go/clients/containerimageregistryclient/reference"
reg "git.novox.be/novox/mesh-delivery/contracts/go/seats/containerimageregistry" reg "git.novox.be/novox/mesh-delivery/contracts/go/seats/containerimageregistry"
stdio "git.novox.be/novox/mesh-sdk/go" stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/catalogue"
"git.novox.be/novox/mesh-catalog/modules/mesh-build-go/buildstep" "git.novox.be/novox/mesh-catalog/modules/mesh-build-go/buildstep"
builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds" builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
@@ -140,7 +140,7 @@ func (m *Module) publish(ctx context.Context, workspace, module, local string, r
} }
m.say("published %s on %s: %d of its %d parts sent, the rest held", name, buildstep.ImageSeat, len(sent.Parts), len(img.Files)) m.say("published %s on %s: %d of its %d parts sent, the rest held", name, buildstep.ImageSeat, len(sent.Parts), len(img.Files))
res.Digest, res.Pushed = img.Digest, true res.Digest, res.Pushed = img.Digest, true
res.Reference = catalogue.SeatReference(buildstep.ImageSeat, module, res.Artifact, img.Digest) res.Reference = artifactref.SeatReference(buildstep.ImageSeat, module, res.Artifact, img.Digest)
return res, nil return res, nil
} }
+1
View File
@@ -3,6 +3,7 @@ module meshbuildimage
go 1.26.0 go 1.26.0
require ( require (
git.novox.be/novox/mesh-delivery/contracts/go/clients/containerimageregistryclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/contracts/go/seats/nodebuildimage v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-delivery/contracts/go/seats/nodebuildimage v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/sdk v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-delivery/sdk v0.0.0-00010101000000-000000000000
@@ -18,9 +18,9 @@ import (
"strings" "strings"
"git.novox.be/novox/mesh-catalog/modules/mesh-build-go/buildstep" "git.novox.be/novox/mesh-catalog/modules/mesh-build-go/buildstep"
artifactref "git.novox.be/novox/mesh-delivery/contracts/go/clients/containerimageregistryclient/reference"
builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds" builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
sdkstep "git.novox.be/novox/mesh-delivery/sdk/buildstep" sdkstep "git.novox.be/novox/mesh-delivery/sdk/buildstep"
"git.novox.be/novox/mesh-sdk/go/catalogue"
) )
// Out is where a bundle's compiled files go in the module's directory (builder toolchain.go:118). // Out is where a bundle's compiled files go in the module's directory (builder toolchain.go:118).
@@ -157,7 +157,7 @@ func (m *Module) build(ctx context.Context, args map[string]any) (any, error) {
}) })
sort.Strings(files) sort.Strings(files)
return BuildResult{Workspace: workspace, Module: module, Artifact: a.Name, Digest: digest, Bytes: len(archive), return BuildResult{Workspace: workspace, Module: module, Artifact: a.Name, Digest: digest, Bytes: len(archive),
Reference: catalogue.SeatReference(buildstep.ArtifactSeat, a.module, a.Name, digest), Files: files}, nil Reference: artifactref.SeatReference(buildstep.ArtifactSeat, a.module, a.Name, digest), Files: files}, nil
} }
// bundle makes every entrypoint and every launcher ONE file, with esbuild (builder.go:1971-2039): an entrypoint is // bundle makes every entrypoint and every launcher ONE file, with esbuild (builder.go:1971-2039): an entrypoint is
@@ -20,9 +20,10 @@ import (
"github.com/distribution/distribution/v3/registry/handlers" "github.com/distribution/distribution/v3/registry/handlers"
_ "github.com/distribution/distribution/v3/registry/storage/driver/inmemory" _ "github.com/distribution/distribution/v3/registry/storage/driver/inmemory"
"git.novox.be/novox/mesh-catalog/modules/mesh-build-go/buildstep"
artifactref "git.novox.be/novox/mesh-delivery/contracts/go/clients/containerimageregistryclient/reference"
registry "git.novox.be/novox/mesh-delivery/contracts/go/seats/containerimageregistry" registry "git.novox.be/novox/mesh-delivery/contracts/go/seats/containerimageregistry"
builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds" builds "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
"git.novox.be/novox/mesh-sdk/go/catalogue"
) )
// realStore starts the artifact store's own program (the distribution registry, modules/distribution) inside this // realStore starts the artifact store's own program (the distribution registry, modules/distribution) inside this
@@ -105,11 +106,11 @@ func TestADoneBundleResolvesInARealArtifactStore(t *testing.T) {
if _, err := builds.EncodeBuilderBuild(done); err != nil { if _, err := builds.EncodeBuilderBuild(done); err != nil {
t.Errorf("the done key the builder would write is refused: %v", err) t.Errorf("the done key the builder would write is refused: %v", err)
} }
if _, _, ok := catalogue.InRegistrySeat(r.Reference); !ok || !strings.HasSuffix(r.Reference, "@"+r.Digest) { if _, _, ok := registryForms.InRegistrySeat(r.Reference); !ok || !strings.HasSuffix(r.Reference, "@"+r.Digest) {
t.Fatalf("the reference %q is not in the form a registry seat answers", r.Reference) t.Fatalf("the reference %q is not in the form a registry seat answers", r.Reference)
} }
// Read as a node-engine reads it: the seat's reference routed to the store's address. // Read as a node-engine reads it: the seat's reference routed to the store's address.
resp, err := http.Get(catalogue.Routed(r.Reference, addr)) resp, err := http.Get(registryForms.Routed(r.Reference, addr))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -120,3 +121,6 @@ func TestADoneBundleResolvesInARealArtifactStore(t *testing.T) {
t.Errorf("the store answered %s with bytes of sha256:%x for %s", resp.Status, sum, r.Reference) t.Errorf("the store answered %s with bytes of sha256:%x for %s", resp.Status, sum, r.Reference)
} }
} }
// registryForms reads a reference of the registry form, the two seats' names from the build step (their contracts).
var registryForms = artifactref.Seats{Image: buildstep.ImageSeat, Object: buildstep.ArtifactSeat}
+1
View File
@@ -3,6 +3,7 @@ module meshbuildnode
go 1.26.0 go 1.26.0
require ( require (
git.novox.be/novox/mesh-delivery/contracts/go/clients/containerimageregistryclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/contracts/go/seats/nodebuildnode v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-delivery/contracts/go/seats/nodebuildnode v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/sdk v0.0.0-00010101000000-000000000000 git.novox.be/novox/mesh-delivery/sdk v0.0.0-00010101000000-000000000000