(input *Input)
| 190 | } |
| 191 | |
| 192 | func (r *SubprocessPluginRuntime) runCLI(input *Input) (*Output, error) { |
| 193 | if _, ok := input.Message.(schema.InputMessageCLIV1); !ok { |
| 194 | return nil, fmt.Errorf("plugin %q input message does not implement InputMessageCLIV1", r.metadata.Name) |
| 195 | } |
| 196 | |
| 197 | extraArgs := input.Message.(schema.InputMessageCLIV1).ExtraArgs |
| 198 | |
| 199 | cmds := r.RuntimeConfig.PlatformCommand |
| 200 | |
| 201 | env := ParseEnv(os.Environ()) |
| 202 | maps.Insert(env, maps.All(r.EnvVars)) |
| 203 | maps.Insert(env, maps.All(ParseEnv(input.Env))) |
| 204 | env["HELM_PLUGIN_NAME"] = r.metadata.Name |
| 205 | env["HELM_PLUGIN_DIR"] = r.pluginDir |
| 206 | |
| 207 | command, args, err := PrepareCommands(cmds, true, extraArgs, env) |
| 208 | if err != nil { |
| 209 | return nil, fmt.Errorf("failed to prepare plugin command: %w", err) |
| 210 | } |
| 211 | |
| 212 | cmd := exec.Command(command, args...) |
| 213 | cmd.Env = FormatEnv(env) |
| 214 | |
| 215 | cmd.Stdin = input.Stdin |
| 216 | cmd.Stdout = input.Stdout |
| 217 | cmd.Stderr = input.Stderr |
| 218 | |
| 219 | slog.Debug("executing plugin command", slog.String("pluginName", r.metadata.Name), slog.String("command", cmd.String())) |
| 220 | if err := executeCmd(cmd, r.metadata.Name); err != nil { |
| 221 | return nil, err |
| 222 | } |
| 223 | |
| 224 | return &Output{ |
| 225 | Message: schema.OutputMessageCLIV1{}, |
| 226 | }, nil |
| 227 | } |
| 228 | |
| 229 | func (r *SubprocessPluginRuntime) runPostrenderer(input *Input) (*Output, error) { |
| 230 | if _, ok := input.Message.(schema.InputMessagePostRendererV1); !ok { |
no test coverage detected