Remove an image's pushed names with its build tag, and take no work under the free-space floor (issue 1834)
mesh/check failed: integration: github.com/novox/mesh-controller/internal/identity.TestACertificateChainsToTheMeshsOwnAuthority: authority_test.go:45:…
mesh/merge-gate head f501eaca4305 merged into trunk 4463991e0609 — pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every …
mesh/repo-check head f501eaca4305 merged into trunk 4463991e0609 — pass: its merge-check.sh passed
mesh/delivery covered: a later merge that contains it was delivered: novox/mesh-controller@01f615aa0ad6 (merged as 8f2d22db into main, walk plan-17926707…

The registry push tags the image a second time, so removing only the build tag freed nothing.
The held image a comparison pulls goes after it is read, and a node under the floor leaves the ask
to another build node instead of taking it and failing.
This commit is contained in:
2026-10-22 13:19:58 +02:00
parent 995f8237ce
commit f501eaca43
8 changed files with 117 additions and 11 deletions
+18 -7
View File
@@ -752,18 +752,25 @@ func keepsImageLocally(publish Publisher) bool {
return false
}
// releaseImage removes the local image tag a build made, with a context of its own: the build's may be cancelled. A
// tag that was never made (the build failed before it) is no fault; one that cannot be removed is said.
func releaseImage(ctx context.Context, run Runner, tag string, say func(step, format string, args ...any)) {
// PushedNames is implemented by a publisher that tags the image under other names to push it: the names it leaves in the
// machine's runtime for a repository, which go with the build's own tag (novox/hq issue 1834).
type PushedNames interface {
PushedNames(repository string) []string
}
// releaseImage removes the names an image was given on the node, in one command: its layers go only with the last. It runs
// with a context of its own, the build's may be cancelled. A name never made (the build failed before it) is no fault;
// one that cannot be removed is said, and removal is said only when the image is gone.
func releaseImage(ctx context.Context, run Runner, names []string, say func(step, format string, args ...any)) {
removing, done := context.WithTimeout(context.WithoutCancel(ctx), time.Minute)
defer done()
if _, err := run(removing, "", "docker", "rmi", tag); err != nil {
if _, err := run(removing, "", "docker", append([]string{"rmi"}, names...)...); err != nil {
if !strings.Contains(err.Error(), "No such image") {
say("image", "the local image %s could not be removed, and goes with the week's sweep: %v", tag, err)
say("image", "the local image %s could not be removed, and goes with the week's sweep: %v", strings.Join(names, ", "), err)
}
return
}
say("image", "the local image %s is removed: the registry holds it", tag)
say("image", "the local image %s is removed: the registry holds it", strings.Join(names, ", "))
}
// contextFrom clones an image artifact's own build context, when it names one apart from this
@@ -1246,7 +1253,11 @@ func one(ctx context.Context, run Runner, publish Publisher,
// a tag per module and commit left on the node was the 96 GB of a full disk. Only a node publishing nowhere (a
// mesh being raised) keeps it, since the local image is then the artifact.
if !keepsImageLocally(publish) {
defer releaseImage(ctx, run, local, say)
names := []string{local}
if p, ok := publish.(PushedNames); ok {
names = append(names, p.PushedNames(module+"/"+a.Name)...)
}
defer releaseImage(ctx, run, names, say)
}
if _, err := run(ctx, buildDir, "docker", invocation...); err != nil {
return catalogue.Built{}, fmt.Errorf("%s: building %s failed: %w", module, a.Name, err)