-
Notifications
You must be signed in to change notification settings - Fork 367
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 --storage-id flag to Repo Create CLI #8557
Changes from 11 commits
ad9e32c
94a246c
5411788
9a76eac
c7ac2e2
efe5832
44a2706
c5bdb3c
06aac0f
71e445a
3700ede
c6b4cbb
8b7c88d
2049918
4159a45
0e64d9e
9242822
4b19558
382207a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,14 +25,18 @@ var repoCreateCmd = &cobra.Command{ | |
clt := getClient() | ||
u := MustParseRepoURI("repository URI", args[0]) | ||
fmt.Println("Repository:", u) | ||
|
||
defaultBranch, err := cmd.Flags().GetString("default-branch") | ||
if err != nil { | ||
DieErr(err) | ||
} | ||
storageID, _ := cmd.Flags().GetString("storage-id") | ||
|
||
resp, err := clt.CreateRepositoryWithResponse(cmd.Context(), | ||
&apigen.CreateRepositoryParams{}, | ||
apigen.CreateRepositoryJSONRequestBody{ | ||
Name: u.Repository, | ||
StorageId: &storageID, | ||
StorageNamespace: args[1], | ||
DefaultBranch: &defaultBranch, | ||
}) | ||
|
@@ -48,6 +52,7 @@ var repoCreateCmd = &cobra.Command{ | |
//nolint:gochecknoinits | ||
func init() { | ||
repoCreateCmd.Flags().StringP("default-branch", "d", DefaultBranch, "the default branch of this repository") | ||
repoCreateCmd.Flags().String("storage-id", "", "") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please define the storage-id flag globally (see |
||
|
||
repoCmd.AddCommand(repoCreateCmd) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,16 @@ func TestLakectlBasicRepoActions(t *testing.T) { | |
newStorage := storage + "/new-storage/" | ||
RunCmdAndVerifyFailureWithFile(t, Lakectl()+" repo create lakefs://"+repoName+" "+newStorage, false, "lakectl_repo_create_not_unique", vars) | ||
|
||
// Validate the --storage-id flag (currently only allowed to be empty) | ||
repoNameSID := generateUniqueRepositoryName() | ||
storageSID := generateUniqueStorageNamespace(repoNameSID) | ||
vars = map[string]string{ | ||
"REPO": repoNameSID, | ||
"STORAGE": storageSID, | ||
"BRANCH": mainBranch, | ||
} | ||
RunCmdAndVerifySuccessWithFile(t, Lakectl()+" repo create lakefs://"+repoNameSID+" "+storageSID+" --storage-id \"\"", false, "lakectl_repo_create", vars) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be better to separate this into a different test. |
||
// Fails due to the usage of repos for isolation - esti creates repos in parallel and | ||
// the output of 'repo list' command cannot be well-defined | ||
// RunCmdAndVerifySuccessWithFile(t, Lakectl()+" repo list", false, "lakectl_repo_list_1", vars) | ||
|
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.
What is the difference between the Must and this error handling? What is the reason for this change?
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 it's some merges mixed up.
Updating.
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.
Following a talk with @N-o-Z -
Changed it to
Must
. Same effect, also for optional params.