[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incus-simplestreams: Add prune command #1381

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

presztak
Copy link
Collaborator
@presztak presztak commented Nov 15, 2024

This PR adds a prune command to incus-simplestreams which:

  • Removes orphaned image tarballs (those not referenced by images.json)
  • Finds any broken image and deletes them from the index
  • Removes older versions of a product, retaining only the most recent one

Closes #1303

cmd.Use = "prune"
cmd.Short = "Clean up obsolete files and data"
cmd.Long = cli.FormatSection("Description",
`Cleans up obsolote tarball files and removes outdated versions of a product
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo, should be obsolete

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment on lines 37 to 38
The prune command identifies and deletes older versions of product data,
retaining only the most recent existing version.`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That last paragraph and the fact that the prune command has prune-versions flag is pretty confusing.

I think I'd rephrase that last paragraph as:


Additionally this command will delete older images, keeping a configurable number of older images per product.

Then instead of prune-version we should probably just have a --retention flag which defaults to 2 as in we'll keep two older versions of the product by default (same as we do on the public image server).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So running incus-simplestreams prune should:

  • Find any orphaned files (no record in the index) and delete them
  • Find any broken image and delete them from the index
  • Find any product that has more than 1+flagRetention images and delete the older ones

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by broken image?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be an image that's in the index but for which some of the files are missing on disk.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Signed-off-by: Piotr Resztak <piotr.resztak@futurfusion.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

incus-simplestreams : missing prune features
2 participants