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:
Bhargav Ravuri
2023-02-11 21:32:01 +05:30
committed by GitHub
parent 61b67f8bed
commit 6a4ca793c9
12 changed files with 348 additions and 55 deletions

View File

@@ -4,16 +4,17 @@ import (
"context"
"encoding/json"
"fmt"
"net/http"
"os"
"strings"
"time"
"github.com/joomcode/errorx"
"github.com/komodorio/helm-dashboard/pkg/dashboard/objects"
"github.com/komodorio/helm-dashboard/pkg/dashboard/subproc"
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cli"
"helm.sh/helm/v3/pkg/registry"
"net/http"
"os"
"strings"
"time"
"github.com/gin-gonic/gin"
"github.com/hashicorp/go-version"
@@ -28,10 +29,11 @@ type Server struct {
Address string
Debug bool
NoTracking bool
Devel bool
}
func (s *Server) StartServer(ctx context.Context, cancel context.CancelFunc) (string, utils.ControlChan, error) {
data, err := objects.NewDataLayer(s.Namespaces, s.Version, NewHelmConfig)
data, err := objects.NewDataLayer(s.Namespaces, s.Version, NewHelmConfig, s.Devel)
if err != nil {
return "", nil, errorx.Decorate(err, "Failed to create data layer")
}