Free a build node's disk after every build and refuse work under a floor of free space (issue 1834)
A full / made every check on shanks end 'store never became ready' with the reason erased by --rm. Builds now remove their local image tag, narrowed source and context clone; a build or check refuses under 20 GiB free on / and the workspace, saying so; the throwaway store is no longer started with --rm and a store that does not come up reports its exit code and last 20 log lines.
This commit is contained in:
@@ -38,6 +38,9 @@ type recorded struct {
|
||||
stamped time.Time
|
||||
// tree is what git names as the tree of the module's directory; empty answers as for a commit.
|
||||
tree string
|
||||
// builtFrom is the files (slash-separated, relative) of the folder the last `docker build` ran in, read as it ran:
|
||||
// the build removes that folder when it ends (novox/hq issue 1834).
|
||||
builtFrom []string
|
||||
}
|
||||
|
||||
func (r *recorded) run(_ context.Context, dir, name string, args ...string) (string, error) {
|
||||
@@ -53,6 +56,16 @@ func (r *recorded) run(_ context.Context, dir, name string, args ...string) (str
|
||||
break
|
||||
}
|
||||
}
|
||||
if name == "docker" && len(args) > 0 && args[0] == "build" {
|
||||
r.builtFrom = nil
|
||||
_ = filepath.WalkDir(dir, func(p string, d os.DirEntry, err error) error {
|
||||
if err == nil && !d.IsDir() {
|
||||
rel, _ := filepath.Rel(dir, p)
|
||||
r.builtFrom = append(r.builtFrom, filepath.ToSlash(rel))
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
switch {
|
||||
case name == "git" && isClone:
|
||||
repository := args[len(args)-2]
|
||||
|
||||
Reference in New Issue
Block a user