Skip to content
Draft
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
6 changes: 2 additions & 4 deletions pkg/bridge/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func LoadAdditionalResources(ctx context.Context, dockerCLI command.Cli, project
if err != nil {
return nil, err
}
exposed.Add(strconv.Itoa(int(p.Num())))
exposed.Add(p.Port())
}
for _, port := range service.Ports {
exposed.Add(strconv.Itoa(int(port.Target)))
Comment on lines -181 to 184
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not introduced in my changes, but wondering if this code is correct, or if it should preserve the protocol (tcp, udp, ...) https://docs.docker.com/reference/compose-file/services/#expose

Expand Down Expand Up @@ -232,9 +232,7 @@ func inspectWithPull(ctx context.Context, dockerCli command.Cli, imageName strin
}
defer func() { _ = stream.Close() }()

out := dockerCli.Out()
err = jsonmessage.DisplayJSONMessagesStream(stream, out, out.FD(), out.IsTerminal(), nil)
if err != nil {
if err := jsonmessage.DisplayStream(stream, dockerCli.Out()); err != nil {
return image.InspectResponse{}, err
}
if inspect, err = dockerCli.Client().ImageInspect(ctx, imageName); err != nil {
Expand Down
14 changes: 6 additions & 8 deletions pkg/compose/build_classic.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,24 +268,22 @@ func (s *composeService) doBuildImage(ctx context.Context, project *types.Projec
defer response.Body.Close() //nolint:errcheck

imageID := ""
aux := func(msg jsonstream.Message) {
err = jsonmessage.DisplayStream(response.Body, buildBuff, jsonmessage.WithAuxCallback(func(msg jsonstream.Message) {
var result buildtypes.Result
if err := json.Unmarshal(*msg.Aux, &result); err != nil {
logrus.Errorf("Failed to parse aux message: %s", err)
} else {
imageID = result.ID
}
}

err = jsonmessage.DisplayJSONMessagesStream(response.Body, buildBuff, progBuff.FD(), true, aux)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this one works; the old code was unconditionally setting "terminal" to "true".

}))
if err != nil {
var jerr *jsonstream.Error
if errors.As(err, &jerr) {
// If no error code is set, default to 1
if jerr.Code == 0 {
jerr.Code = 1
}
return "", cli.StatusError{Status: jerr.Message, StatusCode: jerr.Code}
//
// TODO(thaJeztah): DisplayStream should return a errdefs Error corresponding with the status-code.
errCode := min(1, jerr.Code)
return "", cli.StatusError{Status: jerr.Message, StatusCode: errCode}
}
return "", err
}
Expand Down
Loading