Skip to content

Commit fde4bfe

Browse files
committed
added toolHomeFolder to download the binaries its respective folders
1 parent 00034f5 commit fde4bfe

11 files changed

Lines changed: 36 additions & 30 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ require (
2828
github.com/json-iterator/go v1.1.12
2929
github.com/juju/ratelimit v1.0.1
3030
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213
31-
github.com/loft-sh/loft-util v0.0.8-alpha
31+
github.com/loft-sh/loft-util v0.0.9-alpha
3232
github.com/loft-sh/notify v0.0.0-20210827094439-0720dcc7feee
3333
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
3434
github.com/mitchellh/go-homedir v1.1.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,8 @@ github.com/loft-sh/loft-util v0.0.7-alpha h1:z8frQKx2WgDzdLz+KNp7ogonpP4QiiCzBSC
767767
github.com/loft-sh/loft-util v0.0.7-alpha/go.mod h1:lsjG5Exh5iEf7Z/87nqwkxx3GRQTizFRLGuS1knF6Cg=
768768
github.com/loft-sh/loft-util v0.0.8-alpha h1:bRyi99kYgSj1Tj08/8VuYyWJJ0qH94SQlepeca5olOQ=
769769
github.com/loft-sh/loft-util v0.0.8-alpha/go.mod h1:lsjG5Exh5iEf7Z/87nqwkxx3GRQTizFRLGuS1knF6Cg=
770+
github.com/loft-sh/loft-util v0.0.9-alpha h1:kGcyTQWxWHWy7bbjhS8Hsq/JRdlSztAU++anV6P+sqk=
771+
github.com/loft-sh/loft-util v0.0.9-alpha/go.mod h1:lsjG5Exh5iEf7Z/87nqwkxx3GRQTizFRLGuS1knF6Cg=
770772
github.com/loft-sh/notify v0.0.0-20210827094439-0720dcc7feee h1:hZ79+pKEbCBrH1dVmgZ4jtFrrDPxgM4zqEP1lHlSnvI=
771773
github.com/loft-sh/notify v0.0.0-20210827094439-0720dcc7feee/go.mod h1:pq83B8lgfCY7tKdegTTXU6DZxGQkcWMowUTOTpTQmqk=
772774
github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=

pkg/devspace/config/loader/variable/predefined_variable.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"encoding/json"
77
"errors"
88
"fmt"
9+
"github.com/loft-sh/devspace/pkg/devspace/config/constants"
910
"os"
1011
"path/filepath"
1112
"strconv"
@@ -55,7 +56,7 @@ var predefinedVars = map[string]PredefinedVariableFunction{
5556
},
5657
"DEVSPACE_KUBECTL_EXECUTABLE": func(ctx context.Context, options *PredefinedVariableOptions, log log.Logger) (interface{}, error) {
5758
debugLog := log.WithLevel(logrus.DebugLevel)
58-
path, err := downloader.NewDownloader(commands.NewKubectlCommand(), debugLog).EnsureCommand(ctx)
59+
path, err := downloader.NewDownloader(commands.NewKubectlCommand(), debugLog, constants.DefaultHomeDevSpaceFolder).EnsureCommand(ctx)
5960
if err != nil {
6061
debugLog.Debugf("Error downloading kubectl: %v", err)
6162
return "", nil

pkg/devspace/deploy/deployer/kubectl/kubectl.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
"context"
66
"fmt"
7+
"github.com/loft-sh/devspace/pkg/devspace/config/constants"
78
"io"
89
"mvdan.cc/sh/v3/expand"
910
"os"
@@ -57,7 +58,7 @@ func New(ctx devspacecontext.Context, deployConfig *latest.DeploymentConfig) (de
5758
if deployConfig.Kubectl.KubectlBinaryPath != "" {
5859
cmdPath = deployConfig.Kubectl.KubectlBinaryPath
5960
} else {
60-
cmdPath, err = downloader.NewDownloader(commands.NewKubectlCommand(), ctx.Log()).EnsureCommand(ctx.Context())
61+
cmdPath, err = downloader.NewDownloader(commands.NewKubectlCommand(), ctx.Log(), constants.DefaultHomeDevSpaceFolder).EnsureCommand(ctx.Context())
6162
if err != nil {
6263
return nil, err
6364
}

pkg/devspace/helm/generic/generic.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package generic
33
import (
44
"context"
55
"fmt"
6+
"github.com/loft-sh/devspace/pkg/devspace/config/constants"
67
devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
78
"github.com/loft-sh/loft-util/pkg/command"
89
"io/ioutil"
@@ -32,7 +33,7 @@ func NewGenericClient(command commands.Command, log log.Logger) Client {
3233
extract: extract.NewExtractor(),
3334
}
3435

35-
c.downloader = downloader.NewDownloader(command, log)
36+
c.downloader = downloader.NewDownloader(command, log, constants.DefaultHomeDevSpaceFolder)
3637
return c
3738
}
3839

pkg/devspace/pipeline/engine/basichandler/handler.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package basichandler
33
import (
44
"context"
55
"fmt"
6+
"github.com/loft-sh/devspace/pkg/devspace/config/constants"
67
"os"
78
"time"
89

@@ -69,7 +70,7 @@ var OverwriteCommands = map[string]func(ctx context.Context, args []string, hand
6970
var EnsureCommands = map[string]func(ctx context.Context, args []string) (string, error){
7071
"kubectl": func(ctx context.Context, args []string) (string, error) {
7172
hc := interp.HandlerCtx(ctx)
72-
path, err := downloader.NewDownloader(commands.NewKubectlCommand(), log.GetFileLogger("shell")).EnsureCommand(ctx)
73+
path, err := downloader.NewDownloader(commands.NewKubectlCommand(), log.GetFileLogger("shell"), constants.DefaultHomeDevSpaceFolder).EnsureCommand(ctx)
7374
if err != nil {
7475
_, _ = fmt.Fprintln(hc.Stderr, err)
7576
return "", interp.NewExitStatus(127)
@@ -78,7 +79,7 @@ var EnsureCommands = map[string]func(ctx context.Context, args []string) (string
7879
},
7980
"helm": func(ctx context.Context, args []string) (string, error) {
8081
hc := interp.HandlerCtx(ctx)
81-
path, err := downloader.NewDownloader(commands.NewHelmV3Command(), log.GetFileLogger("shell")).EnsureCommand(ctx)
82+
path, err := downloader.NewDownloader(commands.NewHelmV3Command(), log.GetFileLogger("shell"), constants.DefaultHomeDevSpaceFolder).EnsureCommand(ctx)
8283
if err != nil {
8384
_, _ = fmt.Fprintln(hc.Stderr, err)
8485
return "", interp.NewExitStatus(127)

vendor/github.com/loft-sh/loft-util/pkg/downloader/commands/helm_v3.go

Lines changed: 4 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/loft-sh/loft-util/pkg/downloader/commands/kubectl.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/loft-sh/loft-util/pkg/downloader/commands/types.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/loft-sh/loft-util/pkg/downloader/downloader.go

Lines changed: 12 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)