Feature 57 (config and provisioning): modules declare config and provisions, their files rendered from templates; synced with main (issues of feature 57, 874)
This commit is contained in:
@@ -25,9 +25,9 @@ type manifest struct {
|
||||
Logs []string `json:"logs"`
|
||||
Tools []string `json:"tools"`
|
||||
Resources []struct {
|
||||
ID string `json:"id"`
|
||||
Path string `json:"path"`
|
||||
Content string `json:"content"`
|
||||
ID string `json:"id"`
|
||||
Path string `json:"path"`
|
||||
Template string `json:"template"`
|
||||
} `json:"resources"`
|
||||
Build struct {
|
||||
Artifacts []struct {
|
||||
@@ -109,7 +109,8 @@ func TestItDeclaresAndHoldsTheIssueTrackerSeatOnceForTheMesh(t *testing.T) {
|
||||
"gitea.gitea_pull_reviews", "records.records_status", "records.records_list", "records.records_read", "mesh-knowledge.knowledge_highest"}) {
|
||||
t.Fatalf("consumes %v, invokes %v", m.Consumes, m.Invokes)
|
||||
}
|
||||
if len(m.Build.Artifacts) != 1 || m.Build.Artifacts[0].From != "cmd/mesh-issues" ||
|
||||
// The tools bundle, and the archive the build packs files/ into for the templates (novox/hq ADR 0349 §2).
|
||||
if len(m.Build.Artifacts) != 2 || m.Build.Artifacts[0].From != "cmd/mesh-issues" || m.Build.Artifacts[1].From != "files" ||
|
||||
m.Build.Artifacts[0].Env["MESH_ISSUES_SETTINGS"] == "" || !reflect.DeepEqual(m.Build.Artifacts[0].Loads, []string{"mesh-issues"}) {
|
||||
t.Fatalf("build %+v", m.Build)
|
||||
}
|
||||
@@ -145,7 +146,7 @@ func TestTheSettingsStartTheCounterAndRegisterTheOwners(t *testing.T) {
|
||||
var content string
|
||||
for _, r := range m.Resources {
|
||||
if r.ID == "settings" {
|
||||
content = r.Content
|
||||
content = templateText(t, map[string]any{"id": r.ID, "template": r.Template})
|
||||
}
|
||||
}
|
||||
var s Settings
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// The module's directory, where its manifest and its files/ are.
|
||||
const moduleDir = "../.."
|
||||
|
||||
// templateText is the text a file resource places on the machine: its template's, in the module's files/
|
||||
// (novox/hq ADR 0349 §2). A resource that names no template, or a template that is not there, fails the test.
|
||||
func templateText(t *testing.T, r map[string]any) string {
|
||||
t.Helper()
|
||||
name, _ := r["template"].(string)
|
||||
if name == "" {
|
||||
t.Fatalf("resource %v names no template", r["id"])
|
||||
}
|
||||
raw, err := os.ReadFile(filepath.Join(moduleDir, filepath.FromSlash(name)))
|
||||
if err != nil {
|
||||
t.Fatalf("resource %v names %s: %v", r["id"], name, err)
|
||||
}
|
||||
return string(raw)
|
||||
}
|
||||
|
||||
// No file resource carries its text inline: each names its template in files/, and the build packs files/
|
||||
// into the one archive the controller reads the templates back from (novox/hq ADR 0349 §2).
|
||||
func TestEveryFileTakesItsTextFromATemplate(t *testing.T) {
|
||||
raw, err := os.ReadFile(filepath.Join(moduleDir, "module.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var m struct {
|
||||
Resources []map[string]any `json:"resources"`
|
||||
Build struct {
|
||||
Artifacts []map[string]any `json:"artifacts"`
|
||||
} `json:"build"`
|
||||
}
|
||||
if err := json.Unmarshal(raw, &m); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, r := range m.Resources {
|
||||
if _, inline := r["content"]; inline {
|
||||
t.Errorf("resource %v keeps its text inline: keep it in files/ and name it as the template", r["id"])
|
||||
}
|
||||
if r["type"] == "file" {
|
||||
templateText(t, r)
|
||||
}
|
||||
}
|
||||
packs := 0
|
||||
for _, a := range m.Build.Artifacts {
|
||||
if a["kind"] == "archive" && a["from"] == "files" {
|
||||
packs++
|
||||
if a["name"] != "files" {
|
||||
t.Errorf("the templates archive is named %v, not files", a["name"])
|
||||
}
|
||||
}
|
||||
}
|
||||
if packs != 1 {
|
||||
t.Errorf("the build packs files/ into %d archives, not one", packs)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
{
|
||||
"first-number": 365,
|
||||
"owners": [
|
||||
"hq",
|
||||
"mesh-catalog",
|
||||
"mesh-catalog modules/adwaita",
|
||||
"mesh-catalog modules/artifact-store-tools",
|
||||
"mesh-catalog modules/asus-zephyrus-g14",
|
||||
"mesh-catalog modules/audit-logger",
|
||||
"mesh-catalog modules/avahi",
|
||||
"mesh-catalog modules/baserow",
|
||||
"mesh-catalog modules/betterbird",
|
||||
"mesh-catalog modules/blueman",
|
||||
"mesh-catalog modules/bluetooth",
|
||||
"mesh-catalog modules/build-agent",
|
||||
"mesh-catalog modules/ca-trust",
|
||||
"mesh-catalog modules/claude-code",
|
||||
"mesh-catalog modules/claude-licence-manager",
|
||||
"mesh-catalog modules/clipmenu",
|
||||
"mesh-catalog modules/confluence",
|
||||
"mesh-catalog modules/cups",
|
||||
"mesh-catalog modules/dbus",
|
||||
"mesh-catalog modules/de-spiegel",
|
||||
"mesh-catalog modules/desk-channel",
|
||||
"mesh-catalog modules/disk-load",
|
||||
"mesh-catalog modules/distribution",
|
||||
"mesh-catalog modules/dmenu",
|
||||
"mesh-catalog modules/dnsmasq",
|
||||
"mesh-catalog modules/docker",
|
||||
"mesh-catalog modules/docker-compose",
|
||||
"mesh-catalog modules/dunst",
|
||||
"mesh-catalog modules/fail2ban",
|
||||
"mesh-catalog modules/feh",
|
||||
"mesh-catalog modules/flatpak",
|
||||
"mesh-catalog modules/fonts",
|
||||
"mesh-catalog modules/forticlient",
|
||||
"mesh-catalog modules/gitea",
|
||||
"mesh-catalog modules/gitlab",
|
||||
"mesh-catalog modules/gnome-keyring",
|
||||
"mesh-catalog modules/grafana",
|
||||
"mesh-catalog modules/hello-web",
|
||||
"mesh-catalog modules/home-assistant",
|
||||
"mesh-catalog modules/hostname",
|
||||
"mesh-catalog modules/i3",
|
||||
"mesh-catalog modules/i3status-rust",
|
||||
"mesh-catalog modules/icecast",
|
||||
"mesh-catalog modules/influxdb",
|
||||
"mesh-catalog modules/invoicing",
|
||||
"mesh-catalog modules/jira",
|
||||
"mesh-catalog modules/keycloak",
|
||||
"mesh-catalog modules/lab",
|
||||
"mesh-catalog modules/lemurs",
|
||||
"mesh-catalog modules/letta",
|
||||
"mesh-catalog modules/local-model-consumer",
|
||||
"mesh-catalog modules/localization",
|
||||
"mesh-catalog modules/logrotate",
|
||||
"mesh-catalog modules/mailu",
|
||||
"mesh-catalog modules/marrytts",
|
||||
"mesh-catalog modules/matrix",
|
||||
"mesh-catalog modules/memory-pressure",
|
||||
"mesh-catalog modules/mesh-catalog",
|
||||
"mesh-catalog modules/mesh-cli",
|
||||
"mesh-catalog modules/mesh-delivery",
|
||||
"mesh-catalog modules/mesh-issues",
|
||||
"mesh-catalog modules/mesh-vault",
|
||||
"mesh-catalog modules/mesh-watcher",
|
||||
"mesh-catalog modules/messenger",
|
||||
"mesh-catalog modules/minio",
|
||||
"mesh-catalog modules/model-usage",
|
||||
"mesh-catalog modules/mongodb",
|
||||
"mesh-catalog modules/mosquitto",
|
||||
"mesh-catalog modules/mounts",
|
||||
"mesh-catalog modules/mssql",
|
||||
"mesh-catalog modules/n8n",
|
||||
"mesh-catalog modules/nats",
|
||||
"mesh-catalog modules/netcheck",
|
||||
"mesh-catalog modules/networkmanager",
|
||||
"mesh-catalog modules/nextcloud",
|
||||
"mesh-catalog modules/nextcloud-client",
|
||||
"mesh-catalog modules/nfs-server",
|
||||
"mesh-catalog modules/nftables",
|
||||
"mesh-catalog modules/nm-applet",
|
||||
"mesh-catalog modules/node-env",
|
||||
"mesh-catalog modules/nodered",
|
||||
"mesh-catalog modules/ollama",
|
||||
"mesh-catalog modules/only-office",
|
||||
"mesh-catalog modules/openai-consumer",
|
||||
"mesh-catalog modules/openrazer",
|
||||
"mesh-catalog modules/pacman",
|
||||
"mesh-catalog modules/photos-eef",
|
||||
"mesh-catalog modules/photos-filip",
|
||||
"mesh-catalog modules/picom",
|
||||
"mesh-catalog modules/polychromatic",
|
||||
"mesh-catalog modules/postgres",
|
||||
"mesh-catalog modules/power",
|
||||
"mesh-catalog modules/powerlevel10k",
|
||||
"mesh-catalog modules/records",
|
||||
"mesh-catalog modules/redis",
|
||||
"mesh-catalog modules/restic",
|
||||
"mesh-catalog modules/rofi",
|
||||
"mesh-catalog modules/route-adapter",
|
||||
"mesh-catalog modules/route-proxy",
|
||||
"mesh-catalog modules/screen-lock",
|
||||
"mesh-catalog modules/searxng",
|
||||
"mesh-catalog modules/sensors",
|
||||
"mesh-catalog modules/showcase",
|
||||
"mesh-catalog modules/slack",
|
||||
"mesh-catalog modules/snapd",
|
||||
"mesh-catalog modules/ssh-client",
|
||||
"mesh-catalog modules/sshd",
|
||||
"mesh-catalog modules/step-ca",
|
||||
"mesh-catalog modules/sudo",
|
||||
"mesh-catalog modules/supabase",
|
||||
"mesh-catalog modules/systemd",
|
||||
"mesh-catalog modules/systemd-networkd",
|
||||
"mesh-catalog modules/systemd-resolved",
|
||||
"mesh-catalog modules/telegram",
|
||||
"mesh-catalog modules/time-sync",
|
||||
"mesh-catalog modules/triggerhappy",
|
||||
"mesh-catalog modules/umami",
|
||||
"mesh-catalog modules/unifi",
|
||||
"mesh-catalog modules/website",
|
||||
"mesh-catalog modules/xclip",
|
||||
"mesh-catalog modules/xdg",
|
||||
"mesh-catalog modules/xorg",
|
||||
"mesh-catalog modules/xterm",
|
||||
"mesh-catalog modules/zfs",
|
||||
"mesh-catalog modules/zsh",
|
||||
"mesh-catalog modules/zsh-autosuggestions",
|
||||
"mesh-catalog modules/zsh-syntax-highlighting",
|
||||
"mesh-controller",
|
||||
"mesh-host",
|
||||
"mesh-lab",
|
||||
"mesh-media-catalog",
|
||||
"mesh-sdk",
|
||||
"mesh-tools"
|
||||
],
|
||||
"duplicate-check": "on",
|
||||
"judge-model": "sonnet",
|
||||
"forge-owner": "novox",
|
||||
"stuck-after": "2h",
|
||||
"worker-stale-after": "24h",
|
||||
"delivered-not-resolved-after": "1h",
|
||||
"decision-floor": 293,
|
||||
"research-floor": 45
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user