From ef1880b6adb28cf7c1e71333dd85de156a73c573 Mon Sep 17 00:00:00 2001 From: Guillaume Lours <705411+glours@users.noreply.github.com> Date: Fri, 25 Apr 2025 21:54:55 +0200 Subject: [PATCH] add support for external binary with provider services Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com> --- pkg/compose/plugins.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pkg/compose/plugins.go b/pkg/compose/plugins.go index 315f464cdcf..d896c58af77 100644 --- a/pkg/compose/plugins.go +++ b/pkg/compose/plugins.go @@ -52,9 +52,19 @@ func (s *composeService) runPlugin(ctx context.Context, project *types.Project, plugin, err := s.getPluginBinaryPath(provider.Type) if err != nil { - return err + if !strings.Contains(err.Error(), "Error: No such CLI plugin") { + return err + } + // look if there is a binary with this name in the path + path, err := exec.LookPath(provider.Type) + if err != nil { + return err + } + plugin = &manager.Plugin{ + Name: provider.Type, + Path: path, + } } - if err := s.checkPluginEnabledInDD(ctx, plugin); err != nil { return err } @@ -195,8 +205,7 @@ func (s *composeService) checkPluginEnabledInDD(ctx context.Context, plugin *man return fmt.Errorf("you should enable model runner to use %q provider services: %s", plugin.Name, err.Error()) } } - } else { - return fmt.Errorf("unsupported provider %q", plugin.Name) + return err } return nil }