mesh-delivery-pipeline: a mover that goes on takes its commit and repository from the head's entry (H-A-768)
A carried, placed, reopened or rerun mover was asked with its old record's commit while the entry at its fingerprint names the head's newer merge commit, so the builder refused the ask. Builds: design 47 H2 H-A-768, H-A-763 (3), H-A-764, H-A-761, H-A-286
This commit is contained in:
@@ -310,6 +310,7 @@ func (v Verbs) reopenGroup(caller string, from seat.Pipeline, group []string, ad
|
|||||||
cur.Movers = Tiers(append(cur.Movers, add...), entries, s.logf)
|
cur.Movers = Tiers(append(cur.Movers, add...), entries, s.logf)
|
||||||
}
|
}
|
||||||
for _, m := range group {
|
for _, m := range group {
|
||||||
|
adoptHead(&cur, m, entries) // the group's movers take their commit from the head's entries (H-A-768)
|
||||||
if len(failedSteps(cur, m)) == 0 {
|
if len(failedSteps(cur, m)) == 0 {
|
||||||
cur.Steps = slices.DeleteFunc(slices.Clone(cur.Steps), func(st seat.StepResult) bool { return st.Module == m })
|
cur.Steps = slices.DeleteFunc(slices.Clone(cur.Steps), func(st seat.StepResult) bool { return st.Module == m })
|
||||||
// The steps placed again take ask ids of their own: an id is made from the pipeline's start and its end count, which the
|
// The steps placed again take ask ids of their own: an id is made from the pipeline's start and its end count, which the
|
||||||
|
|||||||
@@ -432,6 +432,9 @@ func TestAMoverReopenedIsAskedWithTheHeadsPins(t *testing.T) {
|
|||||||
pin := func(v string) catalog.CatalogEntry {
|
pin := func(v string) catalog.CatalogEntry {
|
||||||
e := entries["app"]
|
e := entries["app"]
|
||||||
e.Fp, e.Packages, e.Commit, e.Repository = "src2:ab", map[string]string{sdk: v}, "c1", "o/app"
|
e.Fp, e.Packages, e.Commit, e.Repository = "src2:ab", map[string]string{sdk: v}, "c1", "o/app"
|
||||||
|
if v == "v0.1.27" { // design 47 H2 H-A-768: the head's entry holds the same fingerprint at a newer merge commit
|
||||||
|
e.Commit, e.Repository = "c2", "o/app-moved"
|
||||||
|
}
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
keptHalf := Half{Revision: 11, Source: 41, Entries: map[string]catalog.CatalogEntry{"app": pin("v0.1.26"), "mesh-build-go": entries["mesh-build-go"]}}
|
keptHalf := Half{Revision: 11, Source: 41, Entries: map[string]catalog.CatalogEntry{"app": pin("v0.1.26"), "mesh-build-go": entries["mesh-build-go"]}}
|
||||||
@@ -489,16 +492,24 @@ func TestAMoverReopenedIsAskedWithTheHeadsPins(t *testing.T) {
|
|||||||
if len(asks.asks) == before {
|
if len(asks.asks) == before {
|
||||||
t.Fatalf("%s: nothing was asked", how)
|
t.Fatalf("%s: nothing was asked", how)
|
||||||
}
|
}
|
||||||
want := "v0.1.27"
|
want, wantCommit, wantRepo := "v0.1.27", "c2", "o/app-moved"
|
||||||
if how != "start" && how != "place-unfinished" {
|
if how != "start" && how != "place-unfinished" {
|
||||||
want = "v0.1.26"
|
want, wantCommit, wantRepo = "v0.1.26", "c1", "o/app"
|
||||||
}
|
}
|
||||||
seen := 0
|
seen := 0
|
||||||
for _, ask := range asks.asks[before:] {
|
for _, ask := range asks.asks[before:] {
|
||||||
|
if b, ok := ask.(builds.StepRun); ok { // the build ask names the entry's commit, as the builder's check of the entry needs
|
||||||
|
if len(b.Entries) != 1 || b.Entries[0].Commit != wantCommit {
|
||||||
|
t.Errorf("%s: the build asked %+v, want the entry's commit %s", how, b.Entries, wantCommit)
|
||||||
|
}
|
||||||
|
}
|
||||||
if b, ok := ask.(nodebuildgo.StepAsk); ok && b.Step != nil && b.Step.Fetch.Packages != nil {
|
if b, ok := ask.(nodebuildgo.StepAsk); ok && b.Step != nil && b.Step.Fetch.Packages != nil {
|
||||||
if seen++; b.Step.Fetch.Packages[sdk] != want {
|
if seen++; b.Step.Fetch.Packages[sdk] != want {
|
||||||
t.Errorf("%s: asked %+v, want mesh-sdk pinned to %s", how, b.Step, want)
|
t.Errorf("%s: asked %+v, want mesh-sdk pinned to %s", how, b.Step, want)
|
||||||
}
|
}
|
||||||
|
if b.Step.Commit != wantCommit || b.Step.Fetch.Commit != wantCommit || b.Step.Fetch.Repository != wantRepo {
|
||||||
|
t.Errorf("%s: asked at commit %s (fetch %s of %s), want the commit %s of %s the entry holds", how, b.Step.Commit, b.Step.Fetch.Commit, b.Step.Fetch.Repository, wantCommit, wantRepo)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if seen == 0 {
|
if seen == 0 {
|
||||||
|
|||||||
@@ -130,6 +130,25 @@ func MoverOf(p seat.Pipeline, module string) (seat.Mover, bool) {
|
|||||||
return seat.Mover{}, false
|
return seat.Mover{}, false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// adoptHead sets the commit and repository of p's mover of module, when its entry in entries holds the mover's fingerprint, to
|
||||||
|
// that entry's, so a mover that goes on is asked, and its step ends are matched, at the commit the head's entry names: a same
|
||||||
|
// fingerprint at a newer commit is the same build (design 47 H2 H-A-768, H-A-530). A mover whose entry holds another fingerprint
|
||||||
|
// is left as it is.
|
||||||
|
func adoptHead(p *seat.Pipeline, module string, entries map[string]catalog.CatalogEntry) {
|
||||||
|
e, ok := entries[module]
|
||||||
|
for i, m := range p.Movers {
|
||||||
|
if m.Module != module || !ok || e.Fp != m.Fingerprint {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if e.Commit != "" {
|
||||||
|
p.Movers[i].Commit = e.Commit
|
||||||
|
}
|
||||||
|
if e.Repository != "" {
|
||||||
|
p.Movers[i].Repository = e.Repository
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Moves says whether p moves module.
|
// Moves says whether p moves module.
|
||||||
func Moves(p seat.Pipeline, module string) bool {
|
func Moves(p seat.Pipeline, module string) bool {
|
||||||
_, ok := MoverOf(p, module)
|
_, ok := MoverOf(p, module)
|
||||||
@@ -511,6 +530,10 @@ func (s *Starter) placeMovers(p *seat.Pipeline, reg func(module string) (catalog
|
|||||||
}
|
}
|
||||||
// A mover a same-source re-pin kept is placed from the revision it is kept at, its ids its own (H-A-286).
|
// A mover a same-source re-pin kept is placed from the revision it is kept at, its ids its own (H-A-286).
|
||||||
entries := all
|
entries := all
|
||||||
|
if p.EndCount > 0 { // a mover of an ended pipeline that goes on takes its commit from the head's entry (H-A-768)
|
||||||
|
adoptHead(p, m.Module, all)
|
||||||
|
m = p.Movers[i]
|
||||||
|
}
|
||||||
// A mover of a pipeline that ended and goes on again reads the head's entry when it holds the mover at its fingerprint
|
// A mover of a pipeline that ended and goes on again reads the head's entry when it holds the mover at its fingerprint
|
||||||
// (design 47 H2 H-A-764 (1), H-A-763 (3)); its ids still mix in the kept revision.
|
// (design 47 H2 H-A-764 (1), H-A-763 (3)); its ids still mix in the kept revision.
|
||||||
if rev := kept[m.Module]; rev > 0 && !(p.EndCount > 0 && all[m.Module].Fp == m.Fingerprint) {
|
if rev := kept[m.Module]; rev > 0 && !(p.EndCount > 0 && all[m.Module].Fp == m.Fingerprint) {
|
||||||
|
|||||||
@@ -397,6 +397,11 @@ func (v Verbs) rerun(caller string, in seat.RerunInput, reopens bool) (seat.Reru
|
|||||||
return -1, fmt.Errorf("the %s step of %s is running: it is not asked again", in.Step, p.Pipeline)
|
return -1, fmt.Errorf("the %s step of %s is running: it is not asked again", in.Step, p.Pipeline)
|
||||||
}
|
}
|
||||||
if s.Seat != "" {
|
if s.Seat != "" {
|
||||||
|
if p.Run == "" && v.View != nil { // the record's commit becomes the head entry's before the ask is made (H-A-768)
|
||||||
|
if h, ok := v.View(p.Branch); ok {
|
||||||
|
adoptHead(p, s.Module, h.Entries)
|
||||||
|
}
|
||||||
|
}
|
||||||
if ask, err = v.askOf(*p, *s, caller, now); err != nil {
|
if ask, err = v.askOf(*p, *s, caller, now); err != nil {
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
@@ -676,6 +681,12 @@ func (v Verbs) placedAsk(p seat.Pipeline, s seat.StepResult, id string, now time
|
|||||||
if v.Starter == nil || v.Starter.Registration == nil || v.Starter.Steps == nil || (v.View == nil && p.Run == "") {
|
if v.Starter == nil || v.Starter.Registration == nil || v.Starter.Steps == nil || (v.View == nil && p.Run == "") {
|
||||||
return nil, errors.New("the runner cannot ask a step: it holds no registration or no ask")
|
return nil, errors.New("the runner cannot ask a step: it holds no registration or no ask")
|
||||||
}
|
}
|
||||||
|
if atHead && p.Run == "" && v.View != nil {
|
||||||
|
if h, ok := v.View(p.Branch); ok { // its commit and repository are the head's entry's too (design 47 H2 H-A-768)
|
||||||
|
p.Movers = slices.Clone(p.Movers)
|
||||||
|
adoptHead(&p, s.Module, h.Entries)
|
||||||
|
}
|
||||||
|
}
|
||||||
m, ok := MoverOf(p, s.Module)
|
m, ok := MoverOf(p, s.Module)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("%s moves no module %q", p.Pipeline, s.Module)
|
return nil, fmt.Errorf("%s moves no module %q", p.Pipeline, s.Module)
|
||||||
|
|||||||
Reference in New Issue
Block a user