From d0788254cbfcb2bd80f973dcfd84e05f9b6d2ffa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 9 Jun 2022 10:19:28 +0800 Subject: [PATCH] Fix: vela addon registry get panic (#4136) Signed-off-by: ZhongsJie (cherry picked from commit 0d329e394ed127043783dc6065c5cd92ad86d626) Co-authored-by: ZhongsJie --- references/cli/addon-registry.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/references/cli/addon-registry.go b/references/cli/addon-registry.go index a2ffd3292..6ff72c7da 100644 --- a/references/cli/addon-registry.go +++ b/references/cli/addon-registry.go @@ -223,12 +223,25 @@ func getAddonRegistry(ctx context.Context, c common.Args, name string) error { return err } table := uitable.New() - if registry.OSS != nil { + switch { + case registry.OSS != nil: table.AddRow("NAME", "Type", "ENDPOINT", "BUCKET", "PATH") table.AddRow(registry.Name, "OSS", registry.OSS.Endpoint, registry.OSS.Bucket, registry.OSS.Path) - } else { + case registry.Helm != nil: + table.AddRow("NAME", "Type", "ENDPOINT") + table.AddRow(registry.Name, "Helm", registry.Helm.URL) + case registry.Gitee != nil: table.AddRow("NAME", "Type", "ENDPOINT", "PATH") - table.AddRow(registry.Name, "git", registry.Git.URL, registry.Git.Path) + table.AddRow(registry.Name, "Gitee", registry.Gitee.URL, registry.Gitee.Path) + case registry.Gitlab != nil: + table.AddRow("NAME", "Type", "ENDPOINT", "REPOSITORY", "PATH") + table.AddRow(registry.Name, "Gitlab", registry.Gitlab.URL, registry.Gitlab.Repo, registry.Gitlab.Path) + case registry.Git != nil: + table.AddRow("NAME", "Type", "ENDPOINT", "PATH") + table.AddRow(registry.Name, "Git", registry.Git.URL, registry.Git.Path) + default: + table.AddRow("Name") + table.AddRow(registry.Name) } fmt.Println(table.String()) return nil