MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / Run

Method Run

app/cli/pkg/action/plugin_actions.go:132–155  ·  view source on GitHub ↗

Run executes the PluginExec action

(ctx context.Context, pluginName string, commandName string, config plugins.PluginExecConfig)

Source from the content-addressed store, hash-verified

130
131// Run executes the PluginExec action
132func (action *PluginExec) Run(ctx context.Context, pluginName string, commandName string, config plugins.PluginExecConfig) (*PluginExecResult, error) {
133 action.cfg.Logger.Debug().Str("pluginName", pluginName).Str("command", commandName).Msg("Executing plugin command")
134 plugin, ok := action.manager.GetPlugin(pluginName)
135 if !ok {
136 return nil, fmt.Errorf("plugin '%s' not found", pluginName)
137 }
138
139 result, err := plugin.Plugin.Exec(ctx, config)
140 if err != nil {
141 action.cfg.Logger.Error().Err(err).Str("pluginName", pluginName).Str("command", commandName).Msg("Plugin execution failed")
142 return nil, fmt.Errorf("plugin execution failed: %w", err)
143 }
144
145 if result.Error != "" {
146 action.cfg.Logger.Error().Str("pluginName", pluginName).Str("command", commandName).Str("error", result.Error).Msg("Plugin returned error")
147 }
148
149 action.cfg.Logger.Debug().Str("pluginName", pluginName).Str("command", commandName).Int("exitCode", result.ExitCode).Msg("Plugin command executed")
150 return &PluginExecResult{
151 Output: result.Output,
152 Error: result.Error,
153 ExitCode: result.ExitCode,
154 }, nil
155}
156
157// NewPluginInstall creates a new PluginInstall action
158func NewPluginInstall(cfg *ActionsOpts, manager *plugins.Manager) *PluginInstall {

Callers

nothing calls this directly

Calls 5

GetPluginMethod · 0.80
IntMethod · 0.80
ExecMethod · 0.65
ErrorMethod · 0.65
DebugMethod · 0.45

Tested by

no test coverage detected