Open sed-i opened 1 year ago
Thanks for the suggestion! I've been in this same scenario before too.
charmcraft clean
is a lifecycle command that only operates on the current charmcraft project. I think that adding a flag to clean
that affects other projects wouldn't follow the "principle of least surprise". It would probably need to be a separate command.
Rockcraft recently got a new feature. When you uninstall rockcraft, it removes all rockcraft images and instances in lxd. If we added this to charmcraft, then uninstalling and re-installing charmcraft would solve your problem. However, that isn't a great user experience either.
If it's just about naming then purge
, reset
, destroy
may be less surprising.
Or, because the action is very similar to clean
, perhaps cleanall
or cleanup
?
Not sure about cleanup on uninstall. Would be nice have charms continue to repack quickly across snap refresh.
I like those ideas, I think something like charmcraft purge
would be good. Thanks!
For what it's worth, the remove hook doesn't run on a snap refresh, so the LXD instances are retained when updating.
Perhaps a reset-system
subcommand with a big (default aborting) warning message about how this will affect all charmcraft build environments on this system. (We can offer a --force
or similar to non-interactively allow the command to proceed)
I just want to voice support for this feature (In any form) as having to manually delete bunch of containers every once in a while is just no fun.
Docker has a docker image prune
command and docker system prune
- perhaps we could follow suit
That said, multipass uses multipass purge
so maybe that's more appropriate?
Did not give it much thought, but something like snap set charmcraft provider.lxd=purge
could work. I might also be butchering the system here
Thank you for reporting us your feedback!
The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-2551.
This message was autogenerated
With fresh eyes I think charmcraft purge
is probably the way to go with this.
There are several things we might want to clean up in this:
Since the pip cache is attached to a specific base image, removing a base image can automatically remove its pip cache. However, I've personally come across use cases where I want to clear the pip cache without removing any build images, so I'd like that to be possible too.
With fresh eyes I think
charmcraft purge
is probably the way to go with this. ... Since the pip cache is attached to a specific base image, removing a base image can automatically remove its pip cache. However, I've personally come across use cases where I want to clear the pip cache without removing any build images, so I'd like that to be possible too.
So how about just prompting with a [Y/n]
per artifact category?
cases where I want to clear the pip cache without removing any build images
I imagine 80%+ of the time users would want to wipe it all, so personally I'd like the plain purge
to wipe it all.
In any case, a cheatsheet style doc could help a lot with special cases.
@sed-i I think with the purge
command 1 and 2 would be the most common needs, since #3 may interfere with another ongoing build and #4 would purge things that get automatically managed and cleaned up, but which are also far less likely to get into an unusable state. Something like:
charmcraft purge
- removes pip cache and build containers that are stopped (or maybe in any state other than running)charmcraft purge --include-running
gets rid of all non base containerscharmcraft purge --all
gets rid of the shared pip cache and any runner VMs/containers, including bases.Then to limit further we could have:
charmcraft purge --only-cache
to clear only the pip cachecharmcraft purge --only-builders
to clear only (stopped) build containers/VMs@paulomach that's a possibility too, as long as we provide a way to do it non-interactively as well. I'd want [Y/n]
for "common" categories (1 and 2) and [y/N]
for the others.
I'll need to talk with the rest of the team though, as whatever gets decided for Charmcraft will likely become the standard for all craft applications (with obviously the relevant changes), so whatever we decide should be done carefully.
If it helps, we could start with just purge
and purge --all
for now.
But I wonder if the inverse is easier to grok and extend:
charmcraft purge # all purged
charmcraft purge --keep-cache --keep-running --keep-builders # nothing purged
I ran out of space because
/var/snap/lxd/common/lxd/storage-pools/default/containers/charmcraft*
had a lot of stuff in it.I wonder if it makes sense to add a
--all
flag toclean
so it will run the equivalent of:More precisely,
Or, in nushell,