Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: distinguish docker build errors from streaming errors #6910

Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions integration/build_dependencies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ func TestBuildDependenciesOrder(t *testing.T) {
{
description: "build failure with concurrency=1",
args: []string{"-p", "failed-dependency"},
failure: `unable to stream build output: The command '/bin/sh -c [ "${FAIL}" == "0" ] || false' returned a non-zero code: 1`,
failure: `The command '/bin/sh -c [ "${FAIL}" == "0" ] || false' returned a non-zero code: 1`,
},
{
description: "build failure with concurrency=0",
args: []string{"-p", "failed-dependency", "-p", "concurrency-0"},
failure: `unable to stream build output: The command '/bin/sh -c [ "${FAIL}" == "0" ] || false' returned a non-zero code: 1`,
failure: `The command '/bin/sh -c [ "${FAIL}" == "0" ] || false' returned a non-zero code: 1`,
},
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/skaffold/docker/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"bufio"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -364,6 +365,10 @@ func (l *localDaemon) Build(ctx context.Context, out io.Writer, workspace string
}

if err := streamDockerMessages(out, resp.Body, auxCallback); err != nil {
var jm *jsonmessage.JSONError
if errors.As(err, &jm) {
return "", err
tejal29 marked this conversation as resolved.
Show resolved Hide resolved
}
return "", fmt.Errorf("unable to stream build output: %w", err)
}

Expand Down