-
Notifications
You must be signed in to change notification settings - Fork 360
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
allow lakectl local to be "git data" #7618
Conversation
♻️ PR Preview 2442446 has been successfully destroyed since this PR has been closed. 🤖 By surge-preview |
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.
All in all looks good!
Can we possibly add tests for the new command? We are already testing lakectl local with the git integration in esti - so we have an env to test it
cmd/lakectl/cmd/local_install.go
Outdated
Args: cobra.ExactArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
installDir := args[0] | ||
if strings.HasPrefix(installDir, "~/") { |
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.
We're already using homedir.Expand
in our code - you can use it here too
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.
Done
if !info.IsDir() { | ||
DieFmt("%s: not a directory.\n", installDir) | ||
} | ||
|
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.
Do we also want to verify it's in the 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.
That's possibly error prone: git
is sometimes a script that sets up environment variables before calling the executable, so we can't guarantee the current $PATH
is the one used when executing.
|
||
var localInstallGitPluginCmd = &cobra.Command{ | ||
Use: "install-git-plugin <directory>", | ||
Short: "set up `git data` (directory must exist and be in $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.
Can we add a long description here? I think in this case it's important to describe exactly how to use it
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!
ctx := context.Background() | ||
|
||
var cmd *cobra.Command | ||
baseName := getBasename() |
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.
nit: might want to extract that to a "setupLocalCommand" function
@N-o-Z added tests, not sure why Esti is completely failing now :( would appreciate some help |
I wouldn't say completely :) just the new test that was added. Also needed to generate the cli docs. |
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.
Thanks for adding the test!
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.
Very nice!!
Can you please update https://docs.lakefs.io/howto/local-checkouts.html so that it includes the option to use git data?
013b427
to
2fdb65f
Compare
2fdb65f
to
6365141
Compare
Allow symlinking lakectl -->
git-data
which would triggerlakectl local
asgit data
.This enables calling:
$ git data clone ... $ git data status $ git data commit -m "..."
And so on.
Set up:
Will put a symlink called
git-data
into that path. Calling lakectl by that name will automatically execute thelakectl local
subcommand. By default, callinggit <subcommand>
where<subcommand>
isn't an existing git command will executegit-<subcommand>
.