Repository navigation
fix(updater): remove replaced images after a verified Core update - #1307
Merged
Merged
Conversation
Every update pulled a new image and left the replaced one behind. A Raspberry Pi that followed the beta channel for months held 12 GB of unused Core, updater and optimizer images. A tester without SSH cannot reclaim them, and a full disk breaks the next update itself. After the update is done and healthy, and before the sidecar replaces itself, the updater now removes tags in its own repositories whose image no container uses and which is not an image the site could roll back to. Other repositories and user-built images are never touched. A failed cleanup is logged and never fails the finished update. Closes #1305 Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1305.
Problem
ftw-updaterpulls a new image for every update and never removes the one it replaced. The owner's Raspberry Pi 4 held 221 images, 12.6 GB, 97 % reclaimable, after months on the beta channel. Every beta box accumulates Core (275 MB) and updater (237 MB) images per update, and optimizer images (760 MB) per optimizer version. A tester without SSH cannot reclaim them, and a full disk breaks the next update: the pull fails and the rollback point cannot be written.Change
After the update state is
doneand the service is healthy, and before the sidecar replaces itself (that helper recreates the updater container), the updater lists the tags of its own repositories:ghcr.io/srcfl/ftw,ghcr.io/srcfl/ftw-updater,ghcr.io/srcfl/ftw-optimizer,ghcr.io/frahlg/forty-two-watts,ghcr.io/frahlg/forty-two-watts-updaterand runs
docker image rmon every tag whose imagedocker ps -aq+inspect), andprevious_image_idor any entry inprevious_images(the images this site could roll back to).Untagged leftovers of those repositories are removed by ID. Other repositories and user-built images are never touched. Docker itself refuses to remove an image a container references, so a stale inventory cannot delete a running image. Any failure is logged and never turns a finished update into a failure. Restarts and rollbacks clean nothing.
Evidence
go test ./cmd/ftw-updater/passes with four new tests: removal set and ordering aftercompose up; failure of the container inventory leaves the updatedoneand still self-replaces the sidecar; restart removes nothing;docker imagesoutput parsing including untagged rows.docs/self-update.md. Changeset: patch.Not in scope: cleanup of migration leftovers in the data directory (
history.duckdb,history-hot.db,*.converting); that is a Core concern after a verified history conversion.🤖 Generated with Claude Code