11package v3
22
33import (
4- devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
5- dependencyutil "github.com/loft-sh/devspace/pkg/devspace/dependency/util"
6- "github.com/pkg/errors"
7- "github.com/sirupsen/logrus"
4+ "net/url"
85 "os"
96 "path/filepath"
107 "strconv"
118 "strings"
12- "net/url"
9+
10+ devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
11+ dependencyutil "github.com/loft-sh/devspace/pkg/devspace/dependency/util"
12+ "github.com/pkg/errors"
13+ "github.com/sirupsen/logrus"
1314
1415 "github.com/ghodss/yaml"
1516 "github.com/loft-sh/devspace/pkg/devspace/config/versions/latest"
@@ -30,6 +31,14 @@ func NewClient(log log.Logger) (types.Client, error) {
3031 return c , nil
3132}
3233
34+ func (c * client ) DownloadChart (ctx devspacecontext.Context , helmConfig * latest.HelmConfig ) (string , error ) {
35+ chartName , err := dependencyutil .DownloadDependency (ctx .Context (), ctx .WorkingDir (), helmConfig .Chart .Source , ctx .Log ())
36+ if err != nil {
37+ return "" , err
38+ }
39+ return filepath .Dir (chartName ), nil
40+ }
41+
3342// InstallChart installs the given chart via helm v3
3443func (c * client ) InstallChart (ctx devspacecontext.Context , releaseName string , releaseNamespace string , values map [string ]interface {}, helmConfig * latest.HelmConfig ) (* types.Release , error ) {
3544 valuesFile , err := c .genericHelm .WriteValues (values )
@@ -56,12 +65,11 @@ func (c *client) InstallChart(ctx devspacecontext.Context, releaseName string, r
5665 // Chart settings
5766 chartName := ""
5867 if helmConfig .Chart .Source != nil {
59- chartName , err = dependencyutil . DownloadDependency (ctx . Context (), ctx . WorkingDir (), helmConfig . Chart . Source , ctx . Log () )
68+ chartName , err = c . DownloadChart (ctx , helmConfig )
6069 if err != nil {
6170 return nil , err
6271 }
6372
64- chartName = filepath .Dir (chartName )
6573 args = append (args , chartName )
6674 } else {
6775 var chartRepo string
@@ -157,12 +165,11 @@ func (c *client) Template(ctx devspacecontext.Context, releaseName, releaseNames
157165 // Chart settings
158166 chartName := ""
159167 if helmConfig .Chart .Source != nil {
160- chartName , err = dependencyutil . DownloadDependency (ctx . Context (), ctx . WorkingDir (), helmConfig . Chart . Source , ctx . Log () )
168+ chartName , err = c . DownloadChart (ctx , helmConfig )
161169 if err != nil {
162170 return "" , err
163171 }
164172
165- chartName = filepath .Dir (chartName )
166173 args = append (args , chartName )
167174 } else {
168175 var chartRepo string
0 commit comments