-
Notifications
You must be signed in to change notification settings - Fork 4
feat: implement app cache deletion #59
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
base: main
Are you sure you want to change the base?
Conversation
bef313a to
d95e8dc
Compare
Introduce a `cache clean <app-id>` command to clean app cache. This implementation also tries to stop the related app if running. In case we do not care about that we can simply rm -rf `.cache/*`. Closes arduino#52
d95e8dc to
4f25421
Compare
I think stopping the running app makes sense; otherwise, we could lose the ability to do that afterward. A potential alternative could be to refuse to remove the cache of a running app.
|
|
I also not sure if the command should be in the |
|
I agree with @lucarin91 about the usage of the flag. |
|
I vote for the |
|
While implementing the CLI subcommands I took inspiration from the arduino-cli. My idea was to have similar mapping to what our user based is used to. However I also feel like that the
@lucarin91 yeah I like that |
Add `--force` flag to forcefully terminate the app in case it's running, and then clean the related cache.
|
I'll wait for you guys design decision about the CLI api, in the meantime I've pushed the proposal to introduce the As soon as you reach an agreement shoot me a comment and I'll apply the proposed changes, if any. 🤓 |
|
@alessio-perugini Thinking about it again, |
lucarin91
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested on the board and I found the two bugs in the comments below (1 of them was my fault 😄). After that, I think we could merge this. Thanks in advance.
| if err != nil { | ||
| return err | ||
| } | ||
| if runningApp.FullPath.EqualsTo(app.FullPath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I forgot to add a nil check here 😮💨
| if runningApp.FullPath.EqualsTo(app.FullPath) { | |
| if runningApp != nil && runningApp.FullPath.EqualsTo(app.FullPath) { |
| return ErrCleanCacheRunningApp | ||
| } | ||
| // We try to remove docker related resources at best effort | ||
| _ = StopAndDestroyApp(ctx, app) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an iterator, so you should consume it, otherwise it will not execute anything
| _ = StopAndDestroyApp(ctx, app) | |
| for range StopAndDestroyApp(ctx, app) { | |
| // just consume the iterator | |
| } |
Introduce a
cache clean <app-id>command to clean app cache. This implementation also tries to stop the related app if running. In case we do not care about that we can simply rm -rf.cache/*.Super simple implementation. The stopping of an app could be opionionated, eager to see what you think. In case it's too much we can remove that logic and/or trigger it with a specific flag.
Closes #52