Skip to content

Commit 49a9ce6

Browse files
committed
add support for external binary with provider services
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
1 parent 5bb4603 commit 49a9ce6

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

pkg/compose/plugins.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,19 @@ func (s *composeService) runPlugin(ctx context.Context, project *types.Project,
5252

5353
plugin, err := s.getPluginBinaryPath(provider.Type)
5454
if err != nil {
55-
return err
55+
if !strings.Contains(err.Error(), "Error: No such CLI plugin") {
56+
return err
57+
}
58+
// look if there is a binary with this name in the path
59+
path, err := exec.LookPath(provider.Type)
60+
if err != nil {
61+
return err
62+
}
63+
plugin = &manager.Plugin{
64+
Name: provider.Type,
65+
Path: path,
66+
}
5667
}
57-
5868
if err := s.checkPluginEnabledInDD(ctx, plugin); err != nil {
5969
return err
6070
}
@@ -172,8 +182,7 @@ func (s *composeService) checkPluginEnabledInDD(ctx context.Context, plugin *man
172182
return fmt.Errorf("you should enable model runner to use %q provider services: %s", plugin.Name, err.Error())
173183
}
174184
}
175-
} else {
176-
return fmt.Errorf("unsupported provider %q", plugin.Name)
185+
return err
177186
}
178187
return nil
179188
}

0 commit comments

Comments
 (0)