Skip to content

Commit b1173af

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 b1173af

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

pkg/compose/plugins.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,21 @@ 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
56-
}
55+
if strings.Contains(err.Error(), "Error: No such CLI plugin") {
56+
// look if there is a binary with this name in the path
57+
path, err := exec.LookPath(provider.Type)
58+
if err != nil {
59+
return err
60+
}
61+
plugin = &manager.Plugin{
62+
Name: provider.Type,
63+
Path: path,
64+
}
5765

66+
} else {
67+
return err
68+
}
69+
}
5870
if err := s.checkPluginEnabledInDD(ctx, plugin); err != nil {
5971
return err
6072
}
@@ -172,8 +184,7 @@ func (s *composeService) checkPluginEnabledInDD(ctx context.Context, plugin *man
172184
return fmt.Errorf("you should enable model runner to use %q provider services: %s", plugin.Name, err.Error())
173185
}
174186
}
175-
} else {
176-
return fmt.Errorf("unsupported provider %q", plugin.Name)
187+
return err
177188
}
178189
return nil
179190
}

0 commit comments

Comments
 (0)