MCPcopy Index your code
hub / github.com/devspace-sh/devspace / Exec

Method Exec

pkg/devspace/helm/generic/generic.go:68–89  ·  view source on GitHub ↗
(ctx devspacecontext.Context, args []string)

Source from the content-addressed store, hash-verified

66}
67
68func (c *client) Exec(ctx devspacecontext.Context, args []string) ([]byte, error) {
69 err := c.ensureHelmBinary(ctx.Context())
70 if err != nil {
71 return nil, err
72 }
73
74 if !ctx.KubeClient().IsInCluster() {
75 args = append(args, "--kube-context", ctx.KubeClient().CurrentContext())
76 }
77
78 // disable log for list, because it prints same command multiple times if we've multiple deployments.
79 if args[0] != "list" && args[0] != "registry" && (len(args) == 1 || args[1] != "login") {
80 c.log.Debugf("Execute '%s %s' in directory %s", c.helmPath, strings.Join(args, " "), ctx.WorkingDir())
81 }
82
83 result, err := command.Output(ctx.Context(), ctx.WorkingDir(), ctx.Environ(), c.helmPath, args...)
84 if err != nil {
85 return nil, fmt.Errorf("%s %v", string(result), err)
86 }
87
88 return result, nil
89}
90
91func (c *client) ensureHelmBinary(ctx context.Context) error {
92 if c.helmPath != "" {

Callers

nothing calls this directly

Calls 9

ensureHelmBinaryMethod · 0.95
ContextMethod · 0.65
IsInClusterMethod · 0.65
KubeClientMethod · 0.65
CurrentContextMethod · 0.65
WorkingDirMethod · 0.65
EnvironMethod · 0.65
DebugfMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected