Node build module: a bundle's publish carries the version the ask reserved
Every bundle was published with an empty version, a by-digest publish, so the builder never saw package-published and the bundle was not marked against its reservation. Builds: design 47 H H-A-372
This commit is contained in:
@@ -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)
|
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
|
// 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).
|
// step answers the seat's reference, or fails not stored. The packed bytes are never written to the node (L9). The
|
||||||
if err := m.publishOn(ctx, steprun.ArtifactSeat, a.module+"/"+a.Name, "bundle", "", digest, archive); err != nil {
|
// 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)
|
return nil, fmt.Errorf("%s%s: %w", builds.NotStored, a.Name, err)
|
||||||
}
|
}
|
||||||
files := []string{}
|
files := []string{}
|
||||||
|
|||||||
@@ -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
|
// 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) {
|
func TestADoneBundleAnswersTheReferenceOfTheArchiveItPushed(t *testing.T) {
|
||||||
m, _, _ := builtMachine(t, ``)
|
m, _, _ := builtMachine(t, ``)
|
||||||
store := withStore(t, m)
|
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 {
|
if err != nil {
|
||||||
t.Fatal(err)
|
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 {
|
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)
|
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:
|
// 1587-S7 and S8 (ADR 0498 §2, the lead's decision L9): a publish the holder refuses fails the step `not stored:
|
||||||
|
|||||||
Reference in New Issue
Block a user