Builder: its process runs on the module's account again, with no bus
A process account is granted only what its bus names, never its seat's work, so a builder on an account of its own could build nothing at its first start. The process declares no bus and takes the module's broker credential, as before B13; as the module's one process it is the one reader of the work queue publishes. Class, caps, settings and the publish-queue removal stay. The validator built at this head accepts the builder in the change case (the trunk case refuses it: no class, uncapped states). Builds: design 47 H2 §793, §820; H-A-464 (corrects H-A-454 second addendum); review round 2
This commit is contained in:
@@ -528,8 +528,8 @@ func builtOf(all []versions.ReservedVersion) []versions.ReservedVersion {
|
||||
}
|
||||
|
||||
// publishQueue is the builder's work queue publishes on the bus (design 47 H2 §793; H-A-440, H-A-446 (2), H-A-454): a stream of
|
||||
// the manifest's old streams section with the work-queue retention, the module's own, consumed by the process on its own account
|
||||
// (H-A-454 second addendum), which names it in its bus queues; each item on
|
||||
// the manifest's old streams section with the work-queue retention, the module's own, consumed by the module's one process on the
|
||||
// module's account (H-A-464), which declares no bus and so is the stream's one reader by the module's shape; each item on
|
||||
// `mesh.stream.<module>.event.publish.<holder>.<class>.<module>.<version>` under the message id
|
||||
// `<holder>.<class>.<module>.<version>`. The builder makes the pull consumers at run time as it learns a holder,
|
||||
// `publishes-<holder>-<class>`, with ack wait publish-pause-max, max ack pending four and max deliveries ten, and pulls the live
|
||||
|
||||
@@ -176,10 +176,9 @@ func TestManifestDeclarations(t *testing.T) { // 1607/AC1
|
||||
"oci-artifact-registry.kept", "oci-artifact-registry.published", "oci-artifact-registry.refused", "oci-artifact-registry.removed", "operator-channel.decided"}; !reflect.DeepEqual(sorted(m.Consumes), sorted(want)) {
|
||||
t.Errorf("consumes = %v, want %v", m.Consumes, want)
|
||||
}
|
||||
// H-A-454 (second addendum): beside the module's broker, the process's own account's credential broker-builder.
|
||||
if b, ok := m.OwnSecrets["broker"]; !ok || len(m.OwnSecrets) != 2 || b != "${dir:state}/broker" ||
|
||||
fmt.Sprint(m.OwnSecrets["broker-builder"]) != "map[owner:mesh-delivery-builder path:${dir:state}/broker-builder.secret]" {
|
||||
t.Errorf("own-secrets = %v, want broker and broker-builder", m.OwnSecrets)
|
||||
// H-A-464: the process runs on the module's account, so the module's broker is the one credential.
|
||||
if b, ok := m.OwnSecrets["broker"]; !ok || len(m.OwnSecrets) != 1 || b != "${dir:state}/broker" {
|
||||
t.Errorf("own-secrets = %v, want the module's broker alone", m.OwnSecrets)
|
||||
}
|
||||
if m.SecretsOwner != "mesh-delivery-builder" {
|
||||
t.Errorf("secrets-owner = %q", m.SecretsOwner)
|
||||
@@ -267,7 +266,7 @@ func TestManifestProcess(t *testing.T) { // 1607/AC1
|
||||
t.Errorf("health = %v, want kind unit alone", p["health"])
|
||||
}
|
||||
env, _ := p["env"].(map[string]any)
|
||||
if len(env) != 8 || env["MESH_BUILDER_REVISION_WAIT_FILE"] != "${dir:state}/revision-wait-minutes" || env["MESH_BUILDER_PACKAGE_WAIT_FILE"] != "${dir:state}/package-wait-minutes" || env["MESH_BUILDER_PUBLISH_TRIES_FILE"] != "${dir:state}/publish-tries" || env["MESH_BROKER_FILE"] != "${dir:state}/broker-builder.secret" || env["MESH_BUILDER_TOOLCHAIN_WAIT_FILE"] != "${dir:state}/toolchain-wait-minutes" {
|
||||
if len(env) != 8 || env["MESH_BUILDER_REVISION_WAIT_FILE"] != "${dir:state}/revision-wait-minutes" || env["MESH_BUILDER_PACKAGE_WAIT_FILE"] != "${dir:state}/package-wait-minutes" || env["MESH_BUILDER_PUBLISH_TRIES_FILE"] != "${dir:state}/publish-tries" || env["MESH_BROKER_FILE"] != "${dir:state}/broker" || env["MESH_BUILDER_TOOLCHAIN_WAIT_FILE"] != "${dir:state}/toolchain-wait-minutes" {
|
||||
t.Errorf("env = %v, want the broker file and the path of the toolchain wait's file, never the setting itself (design 47 G §672, A-71)", p["env"])
|
||||
}
|
||||
for k, v := range env {
|
||||
@@ -289,23 +288,19 @@ func TestManifestProcess(t *testing.T) { // 1607/AC1
|
||||
t.Errorf("a settings resource %v: the builder holds no setting since the capacity is the build modules' (ADR 0525 §5)", r)
|
||||
}
|
||||
}
|
||||
// Design 47 H2 §793, H-A-454 (second addendum): the process runs on an account of its own, its bus naming the work queue
|
||||
// publishes in queues and what it does on the bus: the module's emits, consumes and state, and its invokes but the verb
|
||||
// publish-queue it serves and the build seats' current build_current asks (§801); its credential is broker-builder.
|
||||
bus, _ := p["bus"].(map[string]any)
|
||||
var states []string
|
||||
for _, st := range m.State {
|
||||
states = append(states, st.Name)
|
||||
// Design 47 H2 §793, H-A-464: the process declares no bus and runs on the module's account, its credential the module's
|
||||
// broker; as the module's one process it is the one reader of the work queue publishes (ADR 0436 §6).
|
||||
if _, has := p["bus"]; has || env["MESH_BROKER_FILE"] != "${dir:state}/broker" {
|
||||
t.Errorf("the process's bus = %v, broker file %v: want no bus, on the module's broker", p["bus"], env["MESH_BROKER_FILE"])
|
||||
}
|
||||
var invokes []string
|
||||
for _, i := range m.Invokes {
|
||||
if !slices.Contains([]string{"seat:mesh-builds.publish-queue", "seat:node-build-go.current", "seat:node-build-image.current", "seat:node-build-node.current"}, i) { // the tools bundle's
|
||||
invokes = append(invokes, i)
|
||||
processes := 0
|
||||
for _, r := range m.Resources {
|
||||
if r["type"] == "process" {
|
||||
processes++
|
||||
}
|
||||
}
|
||||
if fmt.Sprint(bus["queues"]) != "[publishes]" || fmt.Sprint(bus["emits"]) != fmt.Sprint(m.Emits) || fmt.Sprint(bus["consumes"]) != fmt.Sprint(m.Consumes) ||
|
||||
fmt.Sprint(bus["state"]) != fmt.Sprint(states) || fmt.Sprint(bus["invokes"]) != fmt.Sprint(invokes) || len(bus) != 5 || env["MESH_BROKER_FILE"] != "${dir:state}/broker-builder.secret" {
|
||||
t.Errorf("the process's bus = %v, broker file %v: want publishes in queues, the module's emits, consumes, state and invokes, on broker-builder", bus, env["MESH_BROKER_FILE"])
|
||||
if processes != 1 {
|
||||
t.Errorf("%d processes: the work queue publishes needs the module's one process as its reader (H-A-464)", processes)
|
||||
}
|
||||
// H-A-186, design 47 G §370: a Go package another module imports is a declared package artifact of its module, so every
|
||||
// release publishes it: builds (ADR 0634 §1, ADR 0606 §4), imported by the build modules and the node-engine, and
|
||||
|
||||
@@ -267,11 +267,7 @@
|
||||
"operator-channel"
|
||||
],
|
||||
"own-secrets": {
|
||||
"broker": "${dir:state}/broker",
|
||||
"broker-builder": {
|
||||
"path": "${dir:state}/broker-builder.secret",
|
||||
"owner": "mesh-delivery-builder"
|
||||
}
|
||||
"broker": "${dir:state}/broker"
|
||||
},
|
||||
"secrets-owner": "mesh-delivery-builder",
|
||||
"resources": [
|
||||
@@ -361,7 +357,7 @@
|
||||
"./mesh-delivery-builder"
|
||||
],
|
||||
"env": {
|
||||
"MESH_BROKER_FILE": "${dir:state}/broker-builder.secret",
|
||||
"MESH_BROKER_FILE": "${dir:state}/broker",
|
||||
"MESH_BUILDER_TOOLCHAIN_WAIT_FILE": "${dir:state}/toolchain-wait-minutes",
|
||||
"MESH_BUILDER_REVISION_WAIT_FILE": "${dir:state}/revision-wait-minutes",
|
||||
"MESH_BUILDER_PACKAGE_WAIT_FILE": "${dir:state}/package-wait-minutes",
|
||||
@@ -371,111 +367,6 @@
|
||||
"MESH_BUILDER_RELEASED_KEPT_FILE": "${dir:state}/released-kept"
|
||||
},
|
||||
"user": "mesh-delivery-builder",
|
||||
"bus": {
|
||||
"emits": [
|
||||
"build.asked-again",
|
||||
"version.old-form-closed"
|
||||
],
|
||||
"consumes": [
|
||||
"mesh-conditions.findings-asked",
|
||||
"container-image-registry.kept",
|
||||
"container-image-registry.published",
|
||||
"container-image-registry.refused",
|
||||
"container-image-registry.removed",
|
||||
"go-package-registry.kept",
|
||||
"go-package-registry.published",
|
||||
"go-package-registry.refused",
|
||||
"go-package-registry.removed",
|
||||
"mesh-artifact-sweep.artifacts-gone",
|
||||
"mesh-catalog.seat-definition-changed",
|
||||
"mesh-catalog.seat-definition-removed",
|
||||
"mesh-catalog.version-released",
|
||||
"mesh-catalog.versions-filled",
|
||||
"mesh-conditions.condition-cleared",
|
||||
"mesh-delivery-indexer.take-in.taken",
|
||||
"node-build-go.toolchain-reported",
|
||||
"node-build-node.toolchain-reported",
|
||||
"node-engine.manifest-reads-changed",
|
||||
"node-engine.running",
|
||||
"operator-channel.decided",
|
||||
"npm-package-registry.kept",
|
||||
"npm-package-registry.published",
|
||||
"npm-package-registry.refused",
|
||||
"npm-package-registry.removed",
|
||||
"oci-artifact-registry.kept",
|
||||
"oci-artifact-registry.published",
|
||||
"oci-artifact-registry.refused",
|
||||
"oci-artifact-registry.removed",
|
||||
"seat:mesh-module-assigner.views.assignments",
|
||||
"seat:mesh-module-assigner.views.seat-holders",
|
||||
"mesh-catalog.catalog-revision",
|
||||
"mesh-catalog.registration-changed",
|
||||
"mesh-delivery.source-moved"
|
||||
],
|
||||
"queues": [
|
||||
"publishes"
|
||||
],
|
||||
"state": [
|
||||
"builds",
|
||||
"engine-reads",
|
||||
"findings",
|
||||
"floor-waits",
|
||||
"hearing",
|
||||
"instances",
|
||||
"old-form",
|
||||
"bounds",
|
||||
"taken",
|
||||
"queues",
|
||||
"toolchains-heard",
|
||||
"waits",
|
||||
"reserved",
|
||||
"acted",
|
||||
"asked",
|
||||
"reasks",
|
||||
"versions",
|
||||
"first-views",
|
||||
"unbuildable",
|
||||
"consumers"
|
||||
],
|
||||
"invokes": [
|
||||
"seat:container-image-registry.remove",
|
||||
"seat:container-image-registry.versions",
|
||||
"seat:git.tag",
|
||||
"seat:git.tags",
|
||||
"seat:go-package-registry.remove",
|
||||
"seat:go-package-registry.versions",
|
||||
"seat:mesh-artifact-sweep.held",
|
||||
"seat:mesh-builds.reserved",
|
||||
"seat:mesh-builds.drop",
|
||||
"seat:mesh-catalog.versions",
|
||||
"seat:mesh-hand-acts.hand-act",
|
||||
"seat:mesh-module-assigner.assignments",
|
||||
"seat:mesh-watchdogs.presence",
|
||||
"seat:node-build-go.drop",
|
||||
"seat:node-build-image.drop",
|
||||
"seat:node-build-node.drop",
|
||||
"seat:node-build-go.answer",
|
||||
"seat:node-build-image.answer",
|
||||
"seat:node-build-node.answer",
|
||||
"seat:node-engine.manifest-reads",
|
||||
"seat:npm-package-registry.remove",
|
||||
"seat:npm-package-registry.versions",
|
||||
"seat:oci-artifact-registry.remove",
|
||||
"seat:oci-artifact-registry.versions",
|
||||
"seat:container-image-registry.publish",
|
||||
"seat:go-package-registry.publish",
|
||||
"seat:npm-package-registry.publish",
|
||||
"seat:oci-artifact-registry.publish",
|
||||
"seat:mesh-catalog.entry",
|
||||
"seat:mesh-catalog.registrations",
|
||||
"seat:mesh-catalog.seat-definitions",
|
||||
"seat:mesh-catalog.revision",
|
||||
"seat:mesh-delivery.source",
|
||||
"seat:node-build-go.accept.delivery",
|
||||
"seat:node-build-node.accept.delivery",
|
||||
"seat:node-build-image.accept.delivery"
|
||||
]
|
||||
},
|
||||
"health": {
|
||||
"kind": "unit"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user