build: read body response to check for erroneous image export to docker

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2023-07-03 14:23:48 +02:00
committed by CrazyMax
parent a8f402e28d
commit ef4b984df4
2 changed files with 24 additions and 7 deletions

View File

@ -1,37 +0,0 @@
package progress
import (
"io"
"time"
"github.com/moby/buildkit/client"
"github.com/moby/buildkit/identity"
"github.com/opencontainers/go-digest"
)
func FromReader(w Writer, name string, rc io.ReadCloser) {
dgst := digest.FromBytes([]byte(identity.NewID()))
tm := time.Now()
vtx := client.Vertex{
Digest: dgst,
Name: name,
Started: &tm,
}
w.Write(&client.SolveStatus{
Vertexes: []*client.Vertex{&vtx},
})
_, err := io.Copy(io.Discard, rc)
tm2 := time.Now()
vtx2 := vtx
vtx2.Completed = &tm2
if err != nil {
vtx2.Error = err.Error()
}
w.Write(&client.SolveStatus{
Vertexes: []*client.Vertex{&vtx2},
})
}