Say why assign finds no module, and keep an assignment pending on its build
A merge asks for a new module's build, and assign answered "no module of that name" until the build registered it, which read as a module nobody registered (hq issue 325). Keep every build request, tell a build in flight, a module known and not built, and an unknown name apart, and make an assignment made while the build runs when the build registers the module.
This commit is contained in:
@@ -360,7 +360,7 @@ func (f following) SourceMoved(ctx context.Context, m link.SourceMoved) error {
|
||||
}
|
||||
// **A new module is built and registered, and sent nowhere** (novox/hq issue 300): the delivery plan
|
||||
// says so, and assigning it is a person's act, which needs it registered first.
|
||||
built := askNewModules(ctx, m, from, added)
|
||||
built := askNewModules(ctx, inv, m, from, added)
|
||||
moved := append(append([]inventory.Entry{}, touched...), packaging...)
|
||||
if len(moved) == 0 {
|
||||
if len(built) > 0 {
|
||||
@@ -491,7 +491,8 @@ func (f following) SourceMoved(ctx context.Context, m link.SourceMoved) error {
|
||||
// new module either. Outside the plan: the plan walks modules the catalogue holds, and a new one has no
|
||||
// machine to send to and nothing standing on it. What could not be asked is said, and left to `build`.
|
||||
// Returns the directories asked for.
|
||||
func askNewModules(ctx context.Context, m link.SourceMoved, from []inventory.Entry, added []string) []string {
|
||||
func askNewModules(ctx context.Context, inv *inventory.Inventory, m link.SourceMoved, from []inventory.Entry,
|
||||
added []string) []string {
|
||||
if len(added) == 0 || len(from) == 0 {
|
||||
return nil
|
||||
}
|
||||
@@ -503,11 +504,19 @@ func askNewModules(ctx context.Context, m link.SourceMoved, from []inventory.Ent
|
||||
path = ""
|
||||
}
|
||||
id, err := askABuild(ctx, source, path, m.Base)
|
||||
// Kept, asked or not, so `assign` can tell a build in flight, or a merge that could not ask for one,
|
||||
// from a module nobody ever heard of (novox/hq issue 325).
|
||||
request := inventory.BuildRequest{ID: id, Repository: source.Repository, Seat: source.Seat, Path: path,
|
||||
Ref: m.Base, Commit: m.Commit, For: "merge"}
|
||||
if err != nil {
|
||||
request.ID = fmt.Sprintf("not-asked-%s-%s", short(m.Commit), strings.ReplaceAll(dir, "/", "-"))
|
||||
request.NotAsked = err.Error()
|
||||
recordBuildRequest(ctx, inv, request)
|
||||
fmt.Printf(" %s is a new module in %s/%s and could not be built: %v — a hand `build` of it "+
|
||||
"asks again\n", dir, m.Owner, m.Repo, err)
|
||||
continue
|
||||
}
|
||||
recordBuildRequest(ctx, inv, request)
|
||||
fmt.Printf(" %s is a new module in %s/%s: build %s asked at %s; registered when it lands, assigned "+
|
||||
"nowhere\n", dir, m.Owner, m.Repo, id, m.Base)
|
||||
asked = append(asked, dir)
|
||||
|
||||
Reference in New Issue
Block a user