diff --git a/modules/mesh-build-node/cmd/mesh-build-node/build.go b/modules/mesh-build-node/cmd/mesh-build-node/build.go index b0d9e1f07..91d587776 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/build.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/build.go @@ -198,8 +198,9 @@ func (m *Module) build(ctx context.Context, args map[string]any) (any, error) { return nil, fmt.Errorf("packing %s: %w", a.Name, err) } // Published from this process once the build ended, a candidate's as a trunk build's (ADR 0498 §1 §2; CAT-BN3): the - // step answers the seat's reference, or fails not stored. The packed bytes are never written to the node (L9). - if err := m.publishOn(ctx, steprun.ArtifactSeat, a.module+"/"+a.Name, "bundle", "", digest, archive); err != nil { + // step answers the seat's reference, or fails not stored. The packed bytes are never written to the node (L9). The + // publish carries the version the ask reserved, so the builder marks the bundle against its reservation (H-A-372). + if err := m.publishOn(ctx, steprun.ArtifactSeat, a.module+"/"+a.Name, "bundle", version, digest, archive); err != nil { return nil, fmt.Errorf("%s%s: %w", builds.NotStored, a.Name, err) } files := []string{} diff --git a/modules/mesh-build-node/cmd/mesh-build-node/push_test.go b/modules/mesh-build-node/cmd/mesh-build-node/push_test.go index 880a774d7..5e21c8905 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/push_test.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/push_test.go @@ -94,11 +94,14 @@ func archiveOf(t *testing.T, r BuildResult) []byte { } // 1587-S6 (ADR 0498 §1; CAT-BN3): a done bundle is published through oci-artifact-registry and answers the seat's -// reference of its archive, under the manifest's module. +// reference of its archive, under the manifest's module. Its publish names the version the ask reserved, so the bundle +// is marked against its reservation (design 47 H, H-A-372). func TestADoneBundleAnswersTheReferenceOfTheArchiveItPushed(t *testing.T) { m, _, _ := builtMachine(t, ``) store := withStore(t, m) - out, err := m.build(context.Background(), buildArgs()) + args := buildArgs() + args["version"] = "1.4.3" + out, err := m.build(context.Background(), args) if err != nil { t.Fatal(err) } @@ -109,6 +112,9 @@ func TestADoneBundleAnswersTheReferenceOfTheArchiveItPushed(t *testing.T) { if store.blobs["m/tools@"+r.Digest] == nil || len(store.seats) != 1 || store.seats[0] != steprun.ArtifactSeat { t.Errorf("the holder holds %d files through %v, not m/tools@%s through %s", len(store.blobs), store.seats, r.Digest, steprun.ArtifactSeat) } + if len(store.published) != 1 || store.published[0].Version != "1.4.3" { + t.Errorf("the bundle was published as %+v, want the ask's version 1.4.3", store.published) + } } // 1587-S7 and S8 (ADR 0498 §2, the lead's decision L9): a publish the holder refuses fails the step `not stored: