(ctx devspacecontext.Context, args []string)
| 66 | } |
| 67 | |
| 68 | func (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 | |
| 91 | func (c *client) ensureHelmBinary(ctx context.Context) error { |
| 92 | if c.helmPath != "" { |
nothing calls this directly
no test coverage detected