daemon: build a work-seed during image pull, refresh doctor check
Before this change `banger image pull` (both OCI-direct and bundle
paths) shipped images with an empty WorkSeedPath — the BuildWorkSeedImage
helper existed only behind the hidden `banger internal work-seed` CLI.
Every pulled image hit ensureWorkDisk's no-seed branch, and the guest
booted with a bare /root (no .bashrc, no .profile, none of the distro
defaults).
Pull now calls BuildWorkSeedImage after the rootfs is finalised (OCI)
or fetched (bundle). The builder is behind a new `workSeedBuilder` test
seam so existing pull tests don't accidentally demand sudo mount. The
build failure is non-fatal: any error logs a warning and leaves
WorkSeedPath empty — images stay publishable even if the pulled rootfs
has no /root to extract.
Verified end-to-end by wiping the cached smoke image and re-pulling:
work-seed.ext4 lands in the artifact dir next to rootfs.ext4, and all
21 smoke scenarios pass.
Also refreshes the "feature /root work disk" fallback tooling check —
the no-seed path no longer touches mount/umount/cp after commit
0e28504, so the doctor check now only requires truncate + mkfs.ext4.
The warn copy updates from "new VM creates will be slower" to "guest
/root will be empty", which matches the actual tradeoff post-refactor.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
02773c1cf5
commit
3edd7c6de7
8 changed files with 74 additions and 19 deletions
|
|
@ -68,10 +68,11 @@ func TestPullImageBundlePathRegistersFromCatalog(t *testing.T) {
|
|||
runner: system.NewRunner(),
|
||||
}
|
||||
d.img = &ImageService{
|
||||
layout: d.layout,
|
||||
store: d.store,
|
||||
runner: d.runner,
|
||||
bundleFetch: stubBundleFetch(imagecat.Manifest{KernelRef: "generic-6.12"}),
|
||||
layout: d.layout,
|
||||
store: d.store,
|
||||
runner: d.runner,
|
||||
bundleFetch: stubBundleFetch(imagecat.Manifest{KernelRef: "generic-6.12"}),
|
||||
workSeedBuilder: stubWorkSeedBuilder,
|
||||
}
|
||||
wireServices(d)
|
||||
|
||||
|
|
@ -122,10 +123,11 @@ func TestPullImageBundlePathOverrideNameAndKernelRef(t *testing.T) {
|
|||
runner: system.NewRunner(),
|
||||
}
|
||||
d.img = &ImageService{
|
||||
layout: d.layout,
|
||||
store: d.store,
|
||||
runner: d.runner,
|
||||
bundleFetch: stubBundleFetch(imagecat.Manifest{KernelRef: "generic-6.12"}),
|
||||
layout: d.layout,
|
||||
store: d.store,
|
||||
runner: d.runner,
|
||||
bundleFetch: stubBundleFetch(imagecat.Manifest{KernelRef: "generic-6.12"}),
|
||||
workSeedBuilder: stubWorkSeedBuilder,
|
||||
}
|
||||
wireServices(d)
|
||||
|
||||
|
|
@ -164,10 +166,11 @@ func TestPullImageBundlePathRejectsExistingName(t *testing.T) {
|
|||
runner: system.NewRunner(),
|
||||
}
|
||||
d.img = &ImageService{
|
||||
layout: d.layout,
|
||||
store: d.store,
|
||||
runner: d.runner,
|
||||
bundleFetch: stubBundleFetch(imagecat.Manifest{KernelRef: "generic-6.12"}),
|
||||
layout: d.layout,
|
||||
store: d.store,
|
||||
runner: d.runner,
|
||||
bundleFetch: stubBundleFetch(imagecat.Manifest{KernelRef: "generic-6.12"}),
|
||||
workSeedBuilder: stubWorkSeedBuilder,
|
||||
}
|
||||
wireServices(d)
|
||||
id, _ := model.NewID()
|
||||
|
|
@ -194,10 +197,11 @@ func TestPullImageBundlePathRequiresSomeKernelSource(t *testing.T) {
|
|||
runner: system.NewRunner(),
|
||||
}
|
||||
d.img = &ImageService{
|
||||
layout: d.layout,
|
||||
store: d.store,
|
||||
runner: d.runner,
|
||||
bundleFetch: stubBundleFetch(imagecat.Manifest{}),
|
||||
layout: d.layout,
|
||||
store: d.store,
|
||||
runner: d.runner,
|
||||
bundleFetch: stubBundleFetch(imagecat.Manifest{}),
|
||||
workSeedBuilder: stubWorkSeedBuilder,
|
||||
}
|
||||
wireServices(d)
|
||||
// Catalog entry has no kernel_ref, no --kernel-ref/--kernel passed.
|
||||
|
|
@ -226,6 +230,7 @@ func TestPullImageBundleFetchFailurePropagates(t *testing.T) {
|
|||
bundleFetch: func(_ context.Context, _ string, _ imagecat.CatEntry) (imagecat.Manifest, error) {
|
||||
return imagecat.Manifest{}, errors.New("r2 exploded")
|
||||
},
|
||||
workSeedBuilder: stubWorkSeedBuilder,
|
||||
}
|
||||
wireServices(d)
|
||||
_, err := d.img.pullFromBundle(context.Background(), api.ImagePullParams{Ref: "x"}, imagecat.CatEntry{
|
||||
|
|
@ -266,6 +271,7 @@ func TestPullImageDispatchFallsThroughToOCIWhenNoCatalogHit(t *testing.T) {
|
|||
},
|
||||
finalizePulledRootfs: stubFinalizePulledRootfs,
|
||||
bundleFetch: stubBundleFetch(imagecat.Manifest{}),
|
||||
workSeedBuilder: stubWorkSeedBuilder,
|
||||
}
|
||||
wireServices(d)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue