-
Notifications
You must be signed in to change notification settings - Fork 352
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
Implement lakectl local list #6302
Conversation
🎊 PR Preview 1af5109 has been successfully built and deployed to https://treeverse-lakeFS-preview-pr-6302.surge.sh 🕐 Build time: 0.014s 🤖 By surge-preview |
b82d4f4
to
89e5f05
Compare
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.
Added some comments about the code.
What is the use case of this command?
Was expected that we will have a command that will accept or use the current directory and lookup (in path or parents) for our yaml file and dump the information. Command like: lakectl local show.
Using find (command like utility) and lakectl local show I can run something like this list command.
_, err := exec.LookPath("git") // assume git is in path, otherwise consider as not having git support | ||
if err != nil { | ||
return "", ErrNoGit | ||
} |
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'm worried that there will be a long list of errors we would like to capture - why can we have one success and fail with all the rest?
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.
There are 2 types of errors we would like to specifically distinguish from which are the environment doesn't support git, and the current working directory is not a git repository.
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.
You added lookup for git - so in the case we found git - we left only with the fact that that we have git tool and it didn't recognize a git repository.
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.
Remove the generic GitError
pkg/local/index.go
Outdated
return err | ||
} | ||
// don't traverse hidden folders like '.git', etc. | ||
if d.IsDir() && d.Name()[0] == '.' { |
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.
strings.HasPrefix
cmd/lakectl/cmd/local_list.go
Outdated
Headers: []interface{}{ | ||
"Directory", | ||
"Remote URI", | ||
"Last synced HEAD", |
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.
suggestion: "Synced Ref"
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 think the ref is too general. Should be either head or commit. WDYT?
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.
Commit sounds better
cmd/lakectl/cmd/local_list.go
Outdated
import ( | ||
"path/filepath" | ||
|
||
"github.com/cockroachdb/errors" |
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.
"errors" from the std lib
This is basically the same functionality you described. When given a linked directory it will act exactly as 'show', and when providing a parent dir it will find all linked directories under that path |
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.
LGTM - I'll move my functional comment to the design document.
Added comment in ReadIndex
and optional suggestion for the column name.
pkg/local/index.go
Outdated
} | ||
idx := &Index{} | ||
err = yaml.Unmarshal(data, idx) | ||
idx.root = filepath.Dir(idxPath) |
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.
move after the err check
Linked Issue
Closes #6281
Change Description
Background
Implement lakectl local command which lists all folders linked to lakefs paths
New Feature
Part of task #6239
Testing Details
Unit testing for tools, lakectl tests will be added for esti upon feature completion
Breaking Change?
No