mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-26 06:18:04 +00:00
New CLI Flag --devel To Include Development/Prerelease Versions of Charts (#139)
* Include devel Flag for Toggling Dev Chart Versions The flag `--devel` for enabling/disabling dev versions of charts in following endpoints: 1. /api/helm/repositories/kafka-operator 2. /api/helm/repositories/versions 3. /api/helm/repositories/latestver Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io> * Run Tests on Devel Flag Related Changes Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io> --------- Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"github.com/joomcode/errorx"
|
||||
"helm.sh/helm/v3/pkg/action"
|
||||
"helm.sh/helm/v3/pkg/cli"
|
||||
|
||||
// Import to initialize client auth plugins.
|
||||
// From https://github.com/kubernetes/client-go/issues/242
|
||||
_ "k8s.io/client-go/plugin/pkg/client/auth"
|
||||
@@ -22,7 +23,7 @@ type Application struct {
|
||||
Repositories *Repositories
|
||||
}
|
||||
|
||||
func NewApplication(settings *cli.EnvSettings, helmConfig HelmNSConfigGetter, namespaces []string) (*Application, error) {
|
||||
func NewApplication(settings *cli.EnvSettings, helmConfig HelmNSConfigGetter, namespaces []string, devel bool) (*Application, error) {
|
||||
hc, err := helmConfig(settings.Namespace())
|
||||
if err != nil {
|
||||
return nil, errorx.Decorate(err, "failed to get helm config for namespace '%s'", "")
|
||||
@@ -33,6 +34,11 @@ func NewApplication(settings *cli.EnvSettings, helmConfig HelmNSConfigGetter, na
|
||||
return nil, errorx.Decorate(err, "failed to get k8s client")
|
||||
}
|
||||
|
||||
semVerConstraint, err := versionConstaint(devel)
|
||||
if err != nil {
|
||||
return nil, errorx.Decorate(err, "failed to create semantic version constraint")
|
||||
}
|
||||
|
||||
return &Application{
|
||||
HelmConfig: helmConfig,
|
||||
K8s: k8s,
|
||||
@@ -42,8 +48,9 @@ func NewApplication(settings *cli.EnvSettings, helmConfig HelmNSConfigGetter, na
|
||||
HelmConfig: helmConfig,
|
||||
},
|
||||
Repositories: &Repositories{
|
||||
Settings: settings,
|
||||
HelmConfig: hc,
|
||||
Settings: settings,
|
||||
HelmConfig: hc,
|
||||
versionConstraint: semVerConstraint,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user