diff --git a/docs/extension.md b/docs/extension.md index f4f15e521..d01e6c6c7 100644 --- a/docs/extension.md +++ b/docs/extension.md @@ -54,8 +54,9 @@ JSON messages MUST include a `type` and a `message` attribute. `type` can be either: - `info`: Reports status updates to the user. Compose will render message as the service state in the progress UI -- `error`: Lest the user know something went wrong with details about the error. Compose will render the message as the reason for the service failure. +- `error`: Let's the user know something went wrong with details about the error. Compose will render the message as the reason for the service failure. - `setenv`: Let's the plugin tell Compose how dependent services can access the created resource. See next section for further details. +- `debug`: Those messages could help debugging the provider, but are not rendered to the user by default. They are rendered when Compose is started with `--verbose` flag. ```mermaid sequenceDiagram diff --git a/pkg/compose/plugins.go b/pkg/compose/plugins.go index 31279de10..ab5a76432 100644 --- a/pkg/compose/plugins.go +++ b/pkg/compose/plugins.go @@ -30,6 +30,7 @@ import ( "github.com/docker/cli/cli-plugins/manager" "github.com/docker/cli/cli-plugins/socket" "github.com/docker/compose/v2/pkg/progress" + "github.com/sirupsen/logrus" "github.com/spf13/cobra" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/propagation" @@ -44,6 +45,7 @@ const ( ErrorType = "error" InfoType = "info" SetEnvType = "setenv" + DebugType = "debug" ) func (s *composeService) runPlugin(ctx context.Context, project *types.Project, service types.ServiceConfig, command string) error { @@ -123,6 +125,8 @@ func (s *composeService) executePlugin(ctx context.Context, cmd *exec.Cmd, comma return nil, fmt.Errorf("invalid response from plugin: %s", msg.Message) } variables[key] = val + case DebugType: + logrus.Debugf("%s: %s", service.Name, msg.Message) default: return nil, fmt.Errorf("invalid response from plugin: %s", msg.Type) }