Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions pkg/compose/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down Expand Up @@ -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)
}
Expand Down