Skip to content

Commit cedda03

Browse files
committed
fix: run helm registry login
1 parent 42d955e commit cedda03

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

pkg/devspace/config/loader/variable/runtime/runtime_variable.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ var Locations = []string{
2222
"/hooks/*/container/imageSelector",
2323
"/dev/*/imageSelector",
2424
"/dev/*/replaceImage",
25+
"/dev/*/devImage",
2526
"/dev/*/containers/*/replaceImage",
27+
"/dev/*/containers/*/devImage",
2628
"/dev/ports/*/imageSelector",
2729
"/dev/sync/*/imageSelector",
2830
"/dev/logs/*/selectors/*/imageSelector",
2931
"/dev/replacePods/*/imageSelector",
3032
"/dev/replacePods/*/replaceImage",
3133
"/dev/terminal/imageSelector",
3234
"/pipelines/*",
35+
"/pipelines/*/flags/**",
3336
"/pipelines/*/run",
3437
"/commands/*",
3538
"/commands/*/command",

pkg/devspace/helm/generic/generic.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (c *client) Exec(ctx devspacecontext.Context, args []string) ([]byte, error
7474
}
7575

7676
// disable log for list, because it prints same command multiple times if we've multiple deployments.
77-
if args[0] != "list" {
77+
if args[0] != "list" && args[0] != "registry" && (len(args) == 1 || args[1] != "login") {
7878
c.log.Debugf("Execute '%s %s'", c.helmPath, strings.Join(args, " "))
7979
}
8080

pkg/devspace/helm/v3/client.go

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ package v3
33
import (
44
devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
55
dependencyutil "github.com/loft-sh/devspace/pkg/devspace/dependency/util"
6+
"github.com/pkg/errors"
67
"github.com/sirupsen/logrus"
78
"os"
89
"path/filepath"
910
"strconv"
11+
"strings"
1012

1113
"github.com/ghodss/yaml"
1214
"github.com/loft-sh/devspace/pkg/devspace/config/versions/latest"
@@ -71,11 +73,22 @@ func (c *client) InstallChart(ctx devspacecontext.Context, releaseName string, r
7173
if helmConfig.Chart.Version != "" {
7274
args = append(args, "--version", helmConfig.Chart.Version)
7375
}
74-
if helmConfig.Chart.Username != "" {
75-
args = append(args, "--username", helmConfig.Chart.Username)
76-
}
77-
if helmConfig.Chart.Password != "" {
78-
args = append(args, "--password", helmConfig.Chart.Password)
76+
77+
// log into OCI registry if specified
78+
if strings.HasPrefix(chartName, "oci://") {
79+
if helmConfig.Chart.Username != "" && helmConfig.Chart.Password != "" {
80+
_, err := c.genericHelm.Exec(ctx, []string{"registry", "login", "--username", helmConfig.Chart.Username, "--password", helmConfig.Chart.Password})
81+
if err != nil {
82+
return nil, errors.Wrap(err, "login oci registry")
83+
}
84+
}
85+
} else {
86+
if helmConfig.Chart.Username != "" {
87+
args = append(args, "--username", helmConfig.Chart.Username)
88+
}
89+
if helmConfig.Chart.Password != "" {
90+
args = append(args, "--password", helmConfig.Chart.Password)
91+
}
7992
}
8093
}
8194

0 commit comments

Comments
 (0)