diff --git a/cmd/config/subcommand/register/files_config.go b/cmd/config/subcommand/register/files_config.go index 8aea9f099b..9c17c958c8 100644 --- a/cmd/config/subcommand/register/files_config.go +++ b/cmd/config/subcommand/register/files_config.go @@ -4,7 +4,7 @@ package register var ( DefaultFilesConfig = &FilesConfig{ - Version: "v1", + Version: "", ContinueOnError: false, } ) diff --git a/cmd/register/examples.go b/cmd/register/examples.go index c290b52ae2..3e1b805554 100644 --- a/cmd/register/examples.go +++ b/cmd/register/examples.go @@ -18,12 +18,12 @@ const ( Registers all latest flytesnacks example :: - bin/flytectl register examples -d development -p flytesnacks + bin/flytectl register examples -d development -p flytesnacks Registers specific release of flytesnacks example :: - bin/flytectl register examples -d development -p flytesnacks v0.2.176 + bin/flytectl register examples -d development -p flytesnacks --version v0.2.176 Note: register command automatically override the version with release version Usage @@ -37,15 +37,11 @@ var ( func registerExamplesFunc(ctx context.Context, args []string, cmdCtx cmdCore.CommandContext) error { var examples []github.ReleaseAsset - var release string // Deprecated checks for --k8Service deprecatedCheck(ctx, &rconfig.DefaultFilesConfig.K8sServiceAccount, rconfig.DefaultFilesConfig.K8ServiceAccount) - if len(args) == 1 { - release = args[0] - } - examples, tag, err := getAllFlytesnacksExample(githubOrg, flytesnacksRepository, release) + examples, tag, err := getAllFlytesnacksExample(githubOrg, flytesnacksRepository, rconfig.DefaultFilesConfig.Version) if err != nil { return err } diff --git a/cmd/register/register_util.go b/cmd/register/register_util.go index 91657241d3..2e8d3cf6e8 100644 --- a/cmd/register/register_util.go +++ b/cmd/register/register_util.go @@ -538,15 +538,15 @@ func filterExampleFromRelease(releases github.RepositoryRelease) []github.Releas return assets } -func getAllFlytesnacksExample(org, repository, release string) ([]github.ReleaseAsset, string, error) { +func getAllFlytesnacksExample(org, repository, version string) ([]github.ReleaseAsset, string, error) { c := github.NewClient(nil) opt := &github.ListOptions{Page: 1, PerPage: 1} - if len(release) > 0 { - releases, _, err := c.Repositories.GetReleaseByTag(context.Background(), org, repository, release) + if len(version) > 0 { + releases, _, err := c.Repositories.GetReleaseByTag(context.Background(), org, repository, version) if err != nil { return nil, "", err } - return filterExampleFromRelease(*releases), release, nil + return filterExampleFromRelease(*releases), version, nil } releases, _, err := c.Repositories.ListReleases(context.Background(), org, repository, opt) if err != nil {