forked from flyteorg/flyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added customizable fields during registration (flyteorg#80)
Signed-off-by: Prafulla Mahindrakar <[email protected]>
- Loading branch information
1 parent
ff375e1
commit 1e4a6ea
Showing
51 changed files
with
347 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package register | ||
|
||
//go:generate pflags FilesConfig --default-var DefaultFilesConfig --bind-default-var | ||
|
||
var ( | ||
DefaultFilesConfig = &FilesConfig{ | ||
Version: "v1", | ||
ContinueOnError: false, | ||
} | ||
) | ||
|
||
// FilesConfig containing flags used for registration | ||
type FilesConfig struct { | ||
Version string `json:"version" pflag:",version of the entity to be registered with flyte."` | ||
ContinueOnError bool `json:"continueOnError" pflag:",continue on error when registering files."` | ||
Archive bool `json:"archive" pflag:",pass in archive file either an http link or local path."` | ||
AssumableIamRole string `json:"assumableIamRole" pflag:", custom assumable iam auth role to register launch plans with."` | ||
K8ServiceAccount string `json:"k8ServiceAccount" pflag:", custom kubernetes service account auth role to register launch plans with."` | ||
OutputLocationPrefix string `json:"outputLocationPrefix" pflag:", custom output location prefix for offloaded types (files/schemas)."` | ||
} |
23 changes: 23 additions & 0 deletions
23
flytectl/cmd/config/subcommand/register/filesconfig_flags.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
64 changes: 41 additions & 23 deletions
64
...tl/cmd/register/filesconfig_flags_test.go → ...ommand/register/filesconfig_flags_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package register | ||
|
||
import ( | ||
"testing" | ||
|
||
rconfig "github.com/flyteorg/flytectl/cmd/config/subcommand/register" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/mock" | ||
) | ||
|
||
func TestRegisterFromFiles(t *testing.T) { | ||
t.Run("Valid registration", func(t *testing.T) { | ||
setup() | ||
registerFilesSetup() | ||
rconfig.DefaultFilesConfig.Archive = true | ||
args = []string{"testdata/valid-parent-folder-register.tar"} | ||
mockAdminClient.OnCreateTaskMatch(mock.Anything, mock.Anything).Return(nil, nil) | ||
mockAdminClient.OnCreateWorkflowMatch(mock.Anything, mock.Anything).Return(nil, nil) | ||
mockAdminClient.OnCreateLaunchPlanMatch(mock.Anything, mock.Anything).Return(nil, nil) | ||
err := registerFromFilesFunc(ctx, args, cmdCtx) | ||
assert.Nil(t, err) | ||
}) | ||
t.Run("Invalid registration file", func(t *testing.T) { | ||
setup() | ||
registerFilesSetup() | ||
rconfig.DefaultFilesConfig.Archive = true | ||
args = []string{"testdata/invalid.tar"} | ||
err := registerFromFilesFunc(ctx, args, cmdCtx) | ||
assert.NotNil(t, err) | ||
}) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.