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

Fixed prune with a confirmation, a force, and removed the spinner #145

Merged
merged 4 commits into from
Feb 28, 2018

Conversation

febbraro
Copy link
Member

No description provided.

}
cmd.out.Info("Unused Docker images, containers, volumes, and networks cleaned up.")
} else {
cmd.out.Info("Cleanup aborted.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be cmd.out.Warn()? (This is particularly useful if we run a spinner to differentiate no-action from successful action.)


if util.AskYesNo("Are you sure you want to remove all unused containers, networks, images, caches, and volumes?") {
/* #nosec */
if exitCode := util.PassthruCommand(exec.Command("docker", "system", "prune", "--all", "--volumes", "--force")); exitCode != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we start a spinner inside here in case the command might take awhile to run?

Copy link
Member

Choose a reason for hiding this comment

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

If we kept the spinner I think it would still go above this conditional, just inside the AskYesNo block. I'm in favor of it since it can definitely take a while to run and there is no real indication that things are happening. If we leave it off then perhaps just mention in the prompt that this may take a while to execute.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, the actual prune command has a lot of output as it is cleaning up things, so the spinner will likely get in the way. I'll test it out to see.

I'm thinking no spinner, but I'll see what it looks like.

Copy link
Member

Choose a reason for hiding this comment

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

I just did a test and I didn't see any output (so if some is being generated then the spinner is gobbling it). Interestingly, I didn't see the success message until I hit "Enter" while the spinner was running so I thought things might have actually gotten stuck. Interested to see if you get the same experience (and if so then perhaps the note that it'll will take a bit is a better course).

@febbraro
Copy link
Member Author

@grayside @tekante I added the Warn and the spinner. The spinner worked for me, kinda, can you test it to see if it is something we would want to use?

@febbraro
Copy link
Member Author

febbraro commented Feb 22, 2018

screenshot 2018-02-22 15 27 45

@tekante
Copy link
Member

tekante commented Feb 26, 2018

It worked for me though we still seem to have some weird conditions between when the spinner gets overwritten versus when it is augmented. See attached screenshot:

rig-prune

I don't know that those would be a big enough blocker to stop proceeding but it would be nice to figure out what is going on there (I think @grayside dug a good bit and this may be the best we can do).

I'll also note that I had to update to go 1.10 to build it as nfpm now depends on a Format element in archive/tar that 1.9 doesn't seem to recognize.

@febbraro
Copy link
Member Author

@grayside Do you have any thoughts here? I'm torn if the intermittent appending vs newlines (see "Deleted Containers/Images" vs "Deleted Volumes") . Do we care about these inconsistencies? Is it worth it for the spinner? or should we disable the spinner and just drop a quick message like "This may take a while...."?

@grayside
Copy link
Contributor

How much wait time is there when nothing is being output to the screen? If it takes awhile but doesn't leave the user waiting to see progress, I think we should skip the spinner.

I find it jarring to mix the spinner with regular logs in the output for a single command execution, but prune is not a command we are ever likely to mix with something else, and if we do we can address it then.

@febbraro febbraro merged commit 4c1ef6b into develop Feb 28, 2018
@febbraro febbraro deleted the feature/fix-prune branch February 28, 2018 16: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.

3 participants