Skip to content

feat(update): show every layer of a containerd install - #150

Merged
mike-sul merged 3 commits into
mainfrom
feat/containerd-install-progress
Oct 22, 2026
Merged

mike-sul merged 3 commits into
mainfrom
feat/containerd-install-progress

Conversation

@mike-sul

@mike-sul mike-sul commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

The containerd install reported an image as loading and then as loaded with nothing in between, and the progress reporter could drop a state change when the printer was slower than the install.

The reporter gains a call that waits for room, used for every state change, while samples stay lossy. Beside the unpack a watcher polls the snapshots every 100 ms and reports the layer being extracted with the free space its snapshot has taken against the layer's tar size read from the gzip trailer; the differ's reads cannot be observed from outside containerd, so the bar is an estimate. The printer shows one table per image with a row per layer: id, bar, percent, blob size, and exists, the elapsed time or the time it took. On a TTY the table is redrawn in place, otherwise only final rows print. The docker load route gets the same table.

Test: unit tests in pkg/update and pkg/compose, TestCtrdInstallReportsLayers in the e2e suite with CONTAINERD_SNAPSHOTTER=true; an install on a containerd-store dockerd shows the table.

@mike-sul
mike-sul force-pushed the feat/containerd-install-storage branch from 28a8006 to 30173f5 Compare October 22, 2026 10:06
@mike-sul
mike-sul force-pushed the feat/containerd-install-progress branch from b2d03f0 to 78125b5 Compare October 22, 2026 10:06
@mike-sul
mike-sul force-pushed the feat/containerd-install-storage branch from 30173f5 to e37fba0 Compare October 22, 2026 10:33
@mike-sul
mike-sul force-pushed the feat/containerd-install-progress branch from 78125b5 to 4d1c0bf Compare October 22, 2026 10:33
@mike-sul
mike-sul force-pushed the feat/containerd-install-storage branch from e37fba0 to 00a2fbd Compare October 22, 2026 10:40
@mike-sul
mike-sul force-pushed the feat/containerd-install-progress branch 2 times, most recently from 374f898 to a6c83c0 Compare October 22, 2026 11:08
@mike-sul
mike-sul force-pushed the feat/containerd-install-storage branch from 13db147 to 5f36031 Compare October 22, 2026 11:09
@mike-sul
mike-sul force-pushed the feat/containerd-install-progress branch from a6c83c0 to 4a39f45 Compare October 22, 2026 11:09
@mike-sul
mike-sul force-pushed the feat/containerd-install-storage branch from 5f36031 to 3085c7f Compare October 22, 2026 11:40
@mike-sul
mike-sul force-pushed the feat/containerd-install-progress branch from 4a39f45 to 276ace3 Compare October 22, 2026 12:02
The install reporter has a buffer of two and drops an update when the
buffer is full, and Install never stopped it. A burst of per-layer
state changes, or the last ones before Install returned, could be lost
whenever the printer was slower than the install.

The reporter gains Send, which waits for room unless the context is
done, and Install stops the reporter before returning, draining it on
success. The install callback sends every state change of an image or
a layer and keeps Update for the samples between them, so a slow
handler delays a state change rather than loses it.

Assisted-by: Claude Code:claude-fable-5-1
Signed-off-by: Mike Sul <mike.sul@foundries.io>
The containerd install reported an image as loading and then as loaded,
with nothing in between: an app whose layers take minutes to extract
showed no progress at all, where `docker load` reports every layer.

Beside the unpack, a watcher polls the snapshots of the image's layers
and reports the first layer without one as extracting, with the free
space its snapshot has taken from the snapshotter's filesystem against
the size of the layer's tar (read from the gzip trailer, or the blob
size of a plain tar), or with the elapsed time when that size is
unknown; a layer whose snapshot appeared is reported loaded with the
time it was watched. The differ's reads cannot be observed from
outside containerd, so the measure is an estimate. The snapshots are
polled every 100 ms because a layer of a few tens of MiB is extracted
within a second.

The link-in note gains a short section on the per-layer progress.

Assisted-by: Claude Code:claude-fable-5-1
Signed-off-by: Mike Sul <mike.sul@foundries.io>
@mike-sul
mike-sul force-pushed the feat/containerd-install-progress branch from 276ace3 to 7a93f6d Compare October 22, 2026 12:08
@mike-sul
mike-sul changed the base branch from feat/containerd-install-storage to main October 22, 2026 12:08
@mike-sul
mike-sul marked this pull request as ready for review October 22, 2026 12:28
An install into containerd printed only the layers it extracted, one
after the other, and replaced the bar of a layer with the time it took
once it was done, so the user could not tell how many layers an image
had, how many already existed, or how far the whole image had come.

The containerd install now announces every layer of an image before it
starts, as existing or pending, and every layer event carries the size
of its blob. The printer keeps a table per image with one row per layer
(id, bar, percent, size, and whether it existed, how long it has been
loading or how long it took), redraws the table in place on a TTY wide
enough for its rows and prints only each layer's final row otherwise,
and closes the image with its layer count, how many existed and the
time it took. The docker load route reports the last layer of an image
loaded before the image, sends its state changes through the reporter
call that waits for room, and copes with a layer loaded in one message.

The integration test of an install with progress now checks the
events on both routes: every image ends loaded or already existing,
and each of its layers is loaded before it.

Assisted-by: Claude Code:claude-fable-5-1
Signed-off-by: Mike Sul <mike.sul@foundries.io>
@mike-sul
mike-sul force-pushed the feat/containerd-install-progress branch from 7a93f6d to 4c598b8 Compare October 22, 2026 12:33
@mike-sul
mike-sul merged commit 9f7eb50 into main Oct 22, 2026
7 checks passed
@mike-sul
mike-sul deleted the feat/containerd-install-progress branch October 22, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant