Fix: vela addon registry get panic (#4136)

Signed-off-by: ZhongsJie <zhongsjie@gmail.com>
(cherry picked from commit 0d329e394e)

Co-authored-by: ZhongsJie <zhongsjie@gmail.com>
This commit is contained in:
github-actions[bot]
2022-06-09 10:19:28 +08:00
committed by GitHub
parent c72a6aef87
commit d0788254cb

View File

@@ -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