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
Add --latest flag to restore-snapshot command, fixes #1886, fixes #1163 #2724
Conversation
What do you think about adding --list to this one while you're here as well? The biggest problem with restore-snapshot is figuring out which one, and that would help loads. Autocomplete would help even more, but I don't have a clue how to add non-static autocompletes. |
@rfay It depends on the concept. We could also add a About interaction... |
@rfay Found that: https://github.com/manifoldco/promptui |
I really think "restore" should have been a subcommand of snapshot in the first place. I guess it would be a fairly easy thing to add that and then remove the restore-snapshot in a year or so. |
ok. Let me try that out. I can also try out the promptui there. |
@rfay I added the sub-command and also the interaction. The interaction looks really nice: Currently the tests are broken. I do not understand where the problem in the build is. Maybe you can have a look on it to give me a hint. |
There were a couple of painful windows test runner failures, but it looks like right now TestGetLatestSnapshot just doesn't work. That should show up with a manual test run in GoLand or running that single test as in https://github.com/drud/ddev/blob/master/docs/developers/building-contributing.md#testing |
Thanks. Will try it. |
Wow, this terminal library works on Windows in git-bash, PS, and cmd! I've never found one that would do that. We could do so very many things with that! One nit - restore-snapshot shows up in the list twice when you just type "ddev" I've reconsidered what I said yesterday, and think we can just move |
It's truly lovely. I don't think the "restore" is properly in there as a subcommand? Because I can't get help for it, |
@rfay Everything is committed. Also the new sub-command. Tests are in general "green". There is a download/caching issue in the buildkite/ddev-windows-apache-fpm build job. IMHO it's not related to the changes of the PR. |
Just gave it a quick spin. Looks absolutely fantastic! |
@cmuench do you have CircleCI building on your own account? I see that it's not reporting here. |
Did not configure it. |
Weird, I'll chase it. But we sure want that full test. I think what you're doing here would be sorted out by the tests that are running, but the CircleCI tests are the biggest batch. |
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.
Absolutely fantastic, and opens the door for more prompted choices. ddev config <provider>
once had a version that did exactly like this, but there was no way to make it work on Windows and no way to test it.
Made a number of minor requests, the ones with suggestions you can batch and add.
One minor nit,
cmd/ddev/cmd/snapshot_restore.go
Outdated
|
||
if len(snapshots) == 0 { | ||
util.Failed("No snapshots found for project %s", app.GetName()) | ||
os.Exit(1) |
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.
os.Exit(1) |
I'm sure you saw the email from CircleCI - they suggest you might have clicked "follow" on the CircleCI page and so now you have to unfollow. Weirder than weird.
I would have thought only building on your fork would cause this. |
I am not following the project. Did not know that there is a circle-ci integration, before you mention it. "There are no streaming updates available on this page because you do not follow this project." |
Thanks for responding to the CircleCI folks. And I see it's being triggered now. No idea what was going on, but thanks for all! |
40e77d9
to
5acf08f
Compare
Rebased. |
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.
Looks great, fantastic!
@cmuench if you're not exhausted with snapshots there are two remaining open issues regarding snapshots, and your brain is in there. They seem far simpler than the things you've already undertaken. But I know you don't have unlimited time, and also may be done with snapshots :) (Edit: I did the don't-reuse-existing-name one in #2739) |
(Edit: I did the don't-reuse-existing-name one in #2739) |
The Problem/Issue/Bug:
A option to restore the latest snapshot is missing. See #1886 and #1163
Currently we need to pass the name of the latest snapshot as argument.
How this PR Solves The Problem:
Add new
--latest
flag to restore-snapshot command.Modify the sort of the app.ListSnapshots method. Sort files by last modification date.
A new method app.GetLatestSnapshot is introduced.
Manual Testing Instructions:
Automated Testing Overview:
Test for command and app GetLatestSnapshot is included.
Release/Deployment notes:
Changes are backwards compatible.