A stub keeps its module's directories, so the places its own secrets and data name still resolve (issue 1126: novox refused nats's ${dir:mesh-state})
mesh/delivery merged: source.main moved to novox/mesh-sdk@47eb1009921d
mesh/delivery-group group fix/1126-switch-safe merged: every member is merged
mesh/check pass 7359d187db8d on 47b1dcf08f85 | unit 2992 run, 1008 kept, 36 skipped | integration 3025 run, 1102 kept, 29 skipped | over bound: unit (…

This commit is contained in:
2026-10-28 00:21:45 +01:00
parent 47b1dcf08f
commit 7359d187db
2 changed files with 16 additions and 3 deletions
+10 -3
View File
@@ -257,11 +257,18 @@ func NamesBuild(m catalogue.Manifest) bool {
return false return false
} }
// Stub is m with nothing to build and no resource: what it provides, requires, serves and grants still shape the rest of // Stub is m with nothing to build and no resource but its directories: what it provides, requires, serves and grants
// the composition, and nothing of its own is composed (issue 1126). // still shape the rest of the composition, the places its own secrets, data and grants name (${dir:…}) still resolve,
// and nothing else of its own is composed (issue 1126: nats's ${dir:mesh-state} on novox).
func Stub(m catalogue.Manifest) catalogue.Manifest { func Stub(m catalogue.Manifest) catalogue.Manifest {
m.Build = nil m.Build = nil
m.Resources = nil var dirs []map[string]any
for _, r := range m.Resources {
if r["type"] == "directory" {
dirs = append(dirs, r)
}
}
m.Resources = dirs
return m return m
} }
+6
View File
@@ -21,7 +21,10 @@ func answerNamesEveryRefusalAndLeavesAnOldBuildToTheNode(t *testing.T) {
ctx := context.Background() ctx := context.Background()
image := "alpine@sha256:" + strings.Repeat("a", 64) image := "alpine@sha256:" + strings.Repeat("a", 64)
manifest := func(module string) []byte { manifest := func(module string) []byte {
// Its data names its directory, as nats's names ${dir:mesh-state} (issue 1126: novox's own composition refused
// "nats says ${dir:mesh-state}, and nats declares no directory mesh-state" when its stub held no directory).
return []byte(`{"module":"` + module + `","version":"1","capabilities":["container-runtime"],` + return []byte(`{"module":"` + module + `","version":"1","capabilities":["container-runtime"],` +
`"own-secrets":{"token":"${dir:state}/token"},` +
`"resources":[{"id":"state","type":"directory","path":"/var/lib/` + module + `","mode":"0700"},` + `"resources":[{"id":"state","type":"directory","path":"/var/lib/` + module + `","mode":"0700"},` +
`{"id":"server","type":"container","name":"` + module + `","artifact":"site"}],` + `{"id":"server","type":"container","name":"` + module + `","artifact":"site"}],` +
`"build":{"artifacts":[{"name":"site","kind":"upstream","from":"` + image + `"}]}}`) `"build":{"artifacts":[{"name":"site","kind":"upstream","from":"` + image + `"}]}}`)
@@ -38,6 +41,9 @@ func answerNamesEveryRefusalAndLeavesAnOldBuildToTheNode(t *testing.T) {
modules: map[string]delivery.Module{"lemurs": {Manifest: delivery.ManifestDigest(lemurs)}}, modules: map[string]delivery.Module{"lemurs": {Manifest: delivery.ManifestDigest(lemurs)}},
manifests: map[string][]byte{delivery.ManifestDigest(lemurs): lemurs}, manifests: map[string][]byte{delivery.ManifestDigest(lemurs): lemurs},
builds: map[string]*delivery.BuilderBuild{}} builds: map[string]*delivery.BuilderBuild{}}
for _, m := range []string{"web", "api", "spiegel"} {
b.own = append(b.own, compose.OwnSecretRow{Node: "n1", Module: m, Name: "token", Origin: "made", SealedTo: "sk", Sealed: `"box"`})
}
for _, m := range []string{"web", "api", "spiegel"} { for _, m := range []string{"web", "api", "spiegel"} {
raw := manifest(m) raw := manifest(m)
b.manifests[delivery.ManifestDigest(raw)] = raw b.manifests[delivery.ManifestDigest(raw)] = raw