Skip to content

Commit

Permalink
connector/run: add --interactive for stdio connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
mdibaiee committed Sep 28, 2022
1 parent 3004804 commit 4f52237
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions go/connector/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,20 @@ func Run(
) error {
var imageInspectRaw json.RawMessage
var inspects = []ImageInspect{ImageInspect{}}
var inspect ImageInspect
// Pull and inspect the image, saving its output for mounting within the container.
if err := PullImage(ctx, image); err != nil {
return err
} else if imageInspectRaw, err = DockerInspect(ctx, image); err != nil {
return err
} else if err := json.Unmarshal(imageInspectRaw, &inspects); err != nil {
return fmt.Errorf("go.estuary.dev/E132: parsing container image %q inspect results: %w", image, err)
} else {
inspect = inspects[0]
}

var tmpProxy, tmpInspect *os.File

// Find out the port on which the connector will be listening. If there is no
// port specified, then fallback to using connector_proxy and stdio
var port string = inspect.Config.Labels[ConnectorTCPPortLabel]
var port = inspects[0].Config.Labels[ConnectorTCPPortLabel]
if port == "" {
logger.Log(logrus.WarnLevel, logrus.Fields{}, "go.estuary.dev/W002: container did not specify port label, using stdio. Using stdio is deprecated and will be removed in the future.")

Expand Down Expand Up @@ -155,6 +152,7 @@ func Run(
// Mount the connector-proxy binary, as well as the output of inspecting the docker image.
"--mount", fmt.Sprintf("type=bind,source=%s,target=/flow-connector-proxy", tmpProxy.Name()),
"--mount", fmt.Sprintf("type=bind,source=%s,target=/image-inspect.json", tmpInspect.Name()),
"--interactive",
)
} else {
// Publish the tcp port of the container on a random port on host
Expand Down

0 comments on commit 4f52237

Please sign in to comment.