Let a walk wait for its delivery's word, and serve the delivery's owner (hq ADR 0239)
While the mesh-delivery seat has a holder on record, a merge that moves no core module opens its walk and asks nothing until mesh-delivery or a person says go; nothing of it is registered before its turn, so no other send carries it. The controller keeps the planner, the gate, sending and the walk, and gains the verbs the owner asks with: delivery-plan, -order, -check (a group composed as one future state), deliver, delivery-stop, delivery-walks; every walk kept is said as plan-moved.
This commit is contained in:
@@ -232,6 +232,7 @@ var aJudge = map[string]string{
|
||||
"cmd/mesh-controller/main.go": `package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
@@ -252,6 +253,24 @@ func main() {
|
||||
fmt.Println(m + ": ok")
|
||||
}
|
||||
case os.Args[1] == "merge-gate":
|
||||
for i, a := range os.Args {
|
||||
if a == "--group" && i+1 < len(os.Args) {
|
||||
body, _ := os.ReadFile(os.Args[i+1])
|
||||
var heads []struct {
|
||||
Repository string ` + "`json:\"repository\"`" + `
|
||||
Tree string ` + "`json:\"tree\"`" + `
|
||||
}
|
||||
_ = json.Unmarshal(body, &heads)
|
||||
var said []string
|
||||
for _, h := range heads {
|
||||
if _, err := os.Stat(h.Tree + "/module.json"); err == nil {
|
||||
said = append(said, h.Repository)
|
||||
}
|
||||
}
|
||||
fmt.Printf("{\"verdict\":\"pass\",\"summary\":\"composed with %s\"}\n", strings.Join(said, ","))
|
||||
return
|
||||
}
|
||||
}
|
||||
fmt.Println(` + "`" + `{"verdict":"warning","summary":"a merge rebuilds 14 module(s)"}` + "`" + `)
|
||||
}
|
||||
}
|
||||
@@ -323,6 +342,27 @@ func TestTheGateRunsWhenTheGraphIsTouchedBesideTheRepositorysOwnCheck(t *testing
|
||||
t.Fatalf("a fault the base already had failed the change: %+v\n%s", v.Gate, v.Report)
|
||||
}
|
||||
|
||||
// A delivery group (novox/hq ADR 0239): the other heads cloned beside it at their heads and handed to the
|
||||
// gate to compose with this one; the repository's own check is each pull request's, not the group's.
|
||||
app, appHead := aCheckedRepository(t, map[string]string{"module.json": `{"module":"app"}`})
|
||||
repo2, head2 := aCheckedRepository(t, map[string]string{"modules/gitea/module.json": `{"module":"gitea"}`,
|
||||
CheckScript: "exit 1\n"})
|
||||
gid := fmt.Sprintf("check-group-%d", time.Now().UnixNano())
|
||||
v, err = Check(t.Context(), Command, CheckSpec{ID: gid, Repository: repo2, Ref: head2, Owner: "novox",
|
||||
Repo: "mesh-catalog", Paths: []string{"modules/gitea/module.json"}, Beside: beside, Modules: []string{"gitea"},
|
||||
Manifests: []string{"modules/gitea/module.json"}, Toolchain: goToolchain,
|
||||
Group: []GroupHead{{Owner: "novox", Repo: "app", Repository: app, Ref: appHead, Paths: []string{"module.json"}}}},
|
||||
t.TempDir(), registry, GitCredential{}, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if v.Gate.Verdict != "pass" || v.Gate.Summary != "composed with novox/app" {
|
||||
t.Fatalf("the group's other head was not composed: %+v\n%s", v.Gate, v.Report)
|
||||
}
|
||||
if v.Repo == nil || v.Repo.Verdict != "pass" || !strings.Contains(v.Repo.Summary, "group") {
|
||||
t.Fatalf("a group's check ran a member's own script: %+v", v.Repo)
|
||||
}
|
||||
|
||||
// A change to the controller judges itself: one that does not build fails its own gate.
|
||||
v = check(map[string]string{"go.mod": "module x\n\ngo 1.22\n", "cmd/mesh-controller/main.go": "package main\nfunc main() { nope }\n",
|
||||
"modules/gitea/module.json": "{}"}, "self")
|
||||
|
||||
Reference in New Issue
Block a user