Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest]

name: unit-test-${{ matrix.os }}
runs-on: ${{ matrix.os }}

steps:
- name: Set up Go
uses: actions/setup-go@v5
Expand Down
2 changes: 1 addition & 1 deletion cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
"github.com/loft-sh/devspace/pkg/util/fsutil"
"github.com/loft-sh/devspace/pkg/util/log"
"github.com/loft-sh/devspace/pkg/util/survey"
"github.com/loft-sh/loft-util/pkg/command"
"github.com/loft-sh/utils/pkg/command"
"github.com/mgutz/ansi"
"github.com/pkg/errors"
"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/loft-sh/devspace/pkg/util/exit"
"github.com/loft-sh/devspace/pkg/util/interrupt"
"github.com/loft-sh/devspace/pkg/util/log"
"github.com/loft-sh/loft-util/pkg/command"
"github.com/loft-sh/utils/pkg/command"
"mvdan.cc/sh/v3/interp"

"github.com/loft-sh/devspace/cmd/flags"
Expand Down
5 changes: 2 additions & 3 deletions e2e/tests/render/testdata/helm/rendered.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
"app.kubernetes.io/component": "test"
"app.kubernetes.io/managed-by": "Helm"
annotations:
"helm.sh/chart": "component-chart-0.9.1"
"helm.sh/chart": "component-chart-0.9.2"
spec:
replicas: 1
strategy:
Expand All @@ -26,7 +26,7 @@ spec:
"app.kubernetes.io/component": "test"
"app.kubernetes.io/managed-by": "Helm"
annotations:
"helm.sh/chart": "component-chart-0.9.1"
"helm.sh/chart": "component-chart-0.9.2"
spec:
imagePullSecrets:
nodeSelector:
Expand Down Expand Up @@ -78,7 +78,6 @@ spec:
volumeMounts:
initContainers:
volumes:
volumeClaimTemplates:
---
# Source: component-chart/templates/deployment.yaml
# Create headless service for StatefulSet
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ require (
github.com/json-iterator/go v1.1.12
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213
github.com/loft-sh/go-github-selfupdate v1.0.0
github.com/loft-sh/loft-util v0.0.9-alpha
github.com/loft-sh/notify v0.0.0-20210827094439-0720dcc7feee
github.com/loft-sh/programming-language-detection v0.0.5
github.com/loft-sh/utils v0.0.16
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,6 @@ github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhn
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE=
github.com/loft-sh/go-github-selfupdate v1.0.0 h1:YS8iSsIWXw3BygBdPK2xDO4K84XYu2YuYgVS7eQNtik=
github.com/loft-sh/go-github-selfupdate v1.0.0/go.mod h1:LDkR6J2QpqQLIMcYvNaSinVwvjPAkg8278oZBPGnrb8=
github.com/loft-sh/loft-util v0.0.9-alpha h1:kGcyTQWxWHWy7bbjhS8Hsq/JRdlSztAU++anV6P+sqk=
github.com/loft-sh/loft-util v0.0.9-alpha/go.mod h1:lsjG5Exh5iEf7Z/87nqwkxx3GRQTizFRLGuS1knF6Cg=
github.com/loft-sh/notify v0.0.0-20210827094439-0720dcc7feee h1:hZ79+pKEbCBrH1dVmgZ4jtFrrDPxgM4zqEP1lHlSnvI=
github.com/loft-sh/notify v0.0.0-20210827094439-0720dcc7feee/go.mod h1:pq83B8lgfCY7tKdegTTXU6DZxGQkcWMowUTOTpTQmqk=
github.com/loft-sh/programming-language-detection v0.0.5 h1:XiWlxtrf4t6Z7SQiob0JMKaCeMHCP3kWhB80wLt+EMY=
Expand Down
37 changes: 28 additions & 9 deletions hack/build-all.bash
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,32 @@ fi
# Create the release directory
mkdir -p "${DEVSPACE_ROOT}/release"

# Install Helm 3
# Install Helm 4
echo "Installing helm"
curl -s https://get.helm.sh/helm-v3.3.4-darwin-amd64.tar.gz > helm3.tar.gz && tar -zxvf helm3.tar.gz darwin-amd64/helm && chmod +x darwin-amd64/helm
HELM_OS=$(uname -s | tr '[:upper:]' '[:lower:]')
HELM_ARCH=$(uname -m)
case "${HELM_ARCH}" in
x86_64)
HELM_ARCH="amd64"
;;
aarch64|arm64)
HELM_ARCH="arm64"
;;
i386|i686)
HELM_ARCH="386"
;;
esac
HELM_PLATFORM="${HELM_OS}-${HELM_ARCH}"
HELM_VERSION=$(sed -nE 's/^const helmVersion = "([^"]+)"/\1/p' pkg/util/downloader/commands/helm_v4.go)
if [[ -z "${HELM_VERSION}" ]]; then
echo "unable to determine Helm version" 1>&2
exit 1
fi
curl -s "https://get.helm.sh/helm-${HELM_VERSION}-${HELM_PLATFORM}.tar.gz" > helm4.tar.gz && tar -zxvf helm4.tar.gz "${HELM_PLATFORM}/helm" && chmod +x "${HELM_PLATFORM}/helm"

# Pull the component chart
COMPONENT_CHART_VERSION=$(cat pkg/devspace/deploy/deployer/helm/client.go | grep 'Version: "' | sed -nE 's/[^"]+"(.+)",\s*/\1/p')
darwin-amd64/helm pull component-chart --repo https://charts.devspace.sh --version $COMPONENT_CHART_VERSION
"${HELM_PLATFORM}/helm" pull component-chart --repo https://charts.devspace.sh --version $COMPONENT_CHART_VERSION

# Move ui.tar.gz to releases
echo "Moving ui"
Expand All @@ -74,28 +93,28 @@ for OS in ${DEVSPACE_BUILD_PLATFORMS[@]}; do
if [[ "${OS}" == "windows" ]]; then
NAME="${NAME}.exe"
fi

# darwin 386 is deprecated and shouldn't be used anymore
if [[ "${ARCH}" == "386" && "${OS}" == "darwin" ]]; then
echo "Building for ${OS}/${ARCH} not supported."
continue
fi

# arm64 build is only supported for darwin
if [[ "${ARCH}" == "arm64" && "${OS}" == "windows" ]]; then
echo "Building for ${OS}/${ARCH} not supported."
continue
fi

echo "Building for ${OS}/${ARCH}"

# build darwin with CGO_ENABLED=1
if [[ "${OS}" == "darwin" ]]; then
CGO_ENABLED=1
else
CGO_ENABLED=0
CGO_ENABLED=0
fi

# build the DevSpace binary
CGO_ENABLED=${CGO_ENABLED} GOARCH=${ARCH} GOOS=${OS} ${GO_BUILD_CMD} -ldflags "${GO_BUILD_LDFLAGS}"\
-o "${DEVSPACE_ROOT}/release/${NAME}" .
Expand Down
17 changes: 8 additions & 9 deletions pkg/devspace/config/loader/variable/predefined_variable.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,25 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/loft-sh/devspace/pkg/devspace/config/constants"
"os"
"path/filepath"
"strconv"
"strings"
"time"

"github.com/loft-sh/devspace/pkg/devspace/config/constants"
"github.com/loft-sh/devspace/pkg/devspace/config/versions/latest"
"github.com/loft-sh/devspace/pkg/devspace/context/values"
"github.com/loft-sh/devspace/pkg/devspace/kubectl"
"github.com/loft-sh/devspace/pkg/util/log"
"github.com/loft-sh/utils/pkg/downloader"
"github.com/loft-sh/utils/pkg/downloader/commands"
"github.com/sirupsen/logrus"

"github.com/loft-sh/devspace/pkg/devspace/config/versions/latest"
"github.com/loft-sh/devspace/pkg/devspace/plugin"
"github.com/loft-sh/devspace/pkg/devspace/upgrade"
"github.com/loft-sh/devspace/pkg/util/git"
"github.com/loft-sh/devspace/pkg/util/log"
"github.com/loft-sh/devspace/pkg/util/randutil"
"github.com/loft-sh/utils/pkg/downloader"
"github.com/loft-sh/utils/pkg/downloader/commands"
"github.com/mitchellh/go-homedir"
"github.com/sirupsen/logrus"
)

// PredefinedVariableOptions holds the options for a predefined variable to load
Expand Down Expand Up @@ -54,8 +53,8 @@ var predefinedVars = map[string]PredefinedVariableFunction{
}
return ex, nil
},
"DEVSPACE_KUBECTL_EXECUTABLE": func(ctx context.Context, options *PredefinedVariableOptions, log log.Logger) (interface{}, error) {
debugLog := log.WithLevel(logrus.DebugLevel)
"DEVSPACE_KUBECTL_EXECUTABLE": func(ctx context.Context, options *PredefinedVariableOptions, logger log.Logger) (interface{}, error) {
debugLog := logger.WithLevel(logrus.DebugLevel)
path, err := downloader.NewDownloader(commands.NewKubectlCommand(), debugLog, constants.DefaultHomeDevSpaceFolder).EnsureCommand(ctx)
if err != nil {
debugLog.Debugf("Error downloading kubectl: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/devspace/deploy/deployer/helm/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const ComponentChartFolder = "component-chart"
// DevSpaceChartConfig is the config that holds the devspace chart information
var DevSpaceChartConfig = &latest.ChartConfig{
Name: "component-chart",
Version: "0.9.1",
Version: "0.9.2",
RepoURL: "https://charts.devspace.sh",
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/devspace/helm/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package helm

import (
"github.com/loft-sh/devspace/pkg/devspace/helm/types"
v3 "github.com/loft-sh/devspace/pkg/devspace/helm/v3"
v4 "github.com/loft-sh/devspace/pkg/devspace/helm/v4"
"github.com/loft-sh/devspace/pkg/util/log"
)

// NewClient creates a new helm client based on the config
func NewClient(log log.Logger) (types.Client, error) {
return v3.NewClient(log)
return v4.NewClient(log)
}
6 changes: 3 additions & 3 deletions pkg/devspace/helm/generic/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ type Client interface {
WriteValues(values map[string]interface{}) (string, error)
}

func NewGenericClient(command commands.Command, log log.Logger) Client {
func NewGenericClient(command commands.Command, logger log.Logger) Client {
c := &client{
log: log,
log: logger,
extract: extract.NewExtractor(),
}

c.downloader = downloader.NewDownloader(command, log, constants.DefaultHomeDevSpaceFolder)
c.downloader = downloader.NewDownloader(command, logger, constants.DefaultHomeDevSpaceFolder)
return c
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v3
package v4

import (
"net/url"
Expand All @@ -12,8 +12,8 @@ import (
dependencyutil "github.com/loft-sh/devspace/pkg/devspace/dependency/util"
"github.com/loft-sh/devspace/pkg/devspace/helm/generic"
"github.com/loft-sh/devspace/pkg/devspace/helm/types"
devspacecommands "github.com/loft-sh/devspace/pkg/util/downloader/commands"
"github.com/loft-sh/devspace/pkg/util/log"
"github.com/loft-sh/utils/pkg/downloader/commands"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"sigs.k8s.io/yaml"
Expand All @@ -23,10 +23,10 @@ type client struct {
genericHelm generic.Client
}

// NewClient creates a new helm v3 Client
// NewClient creates a new helm v4 Client
func NewClient(log log.Logger) (types.Client, error) {
c := &client{}
c.genericHelm = generic.NewGenericClient(commands.NewHelmV3Command(), log)
c.genericHelm = generic.NewGenericClient(devspacecommands.NewHelmV4Command(), log)
return c, nil
}

Expand All @@ -38,7 +38,7 @@ func (c *client) DownloadChart(ctx devspacecontext.Context, helmConfig *latest.H
return filepath.Dir(chartName), nil
}

// InstallChart installs the given chart via helm v3
// InstallChart installs the given chart via helm v4
func (c *client) InstallChart(ctx devspacecontext.Context, releaseName string, releaseNamespace string, values map[string]interface{}, helmConfig *latest.HelmConfig) (*types.Release, error) {
valuesFile, err := c.genericHelm.WriteValues(values)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/devspace/pipeline/engine/basichandler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/loft-sh/devspace/pkg/devspace/config/constants"
enginecommands "github.com/loft-sh/devspace/pkg/devspace/pipeline/engine/basichandler/commands"
"github.com/loft-sh/devspace/pkg/devspace/pipeline/engine/types"
devspacecommands "github.com/loft-sh/devspace/pkg/util/downloader/commands"
"github.com/loft-sh/devspace/pkg/util/log"
"github.com/loft-sh/utils/pkg/downloader"
"github.com/loft-sh/utils/pkg/downloader/commands"
Expand Down Expand Up @@ -79,7 +80,7 @@ var EnsureCommands = map[string]func(ctx context.Context, args []string) (string
},
"helm": func(ctx context.Context, args []string) (string, error) {
hc := interp.HandlerCtx(ctx)
path, err := downloader.NewDownloader(commands.NewHelmV3Command(), log.GetFileLogger("shell"), constants.DefaultHomeDevSpaceFolder).EnsureCommand(ctx)
path, err := downloader.NewDownloader(devspacecommands.NewHelmV4Command(), log.GetFileLogger("shell"), constants.DefaultHomeDevSpaceFolder).EnsureCommand(ctx)
if err != nil {
_, _ = fmt.Fprintln(hc.Stderr, err)
return "", interp.NewExitStatus(127)
Expand Down
5 changes: 3 additions & 2 deletions pkg/devspace/pipeline/engine/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package engine
import (
"bytes"
"context"
"mvdan.cc/sh/v3/expand"
"os"
"path/filepath"
"strings"
"testing"

"gotest.tools/assert"
"mvdan.cc/sh/v3/expand"
)

type testCaseShell struct {
Expand Down Expand Up @@ -132,5 +132,6 @@ func TestHelmDownload(t *testing.T) {
if err != nil {
t.Fatal(err)
}
assert.Assert(t, strings.Contains(stdout1.String(), `Version:"v3`))

assert.Assert(t, strings.Contains(stdout1.String(), `Version:"v4`))
}
Loading
Loading