mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
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:
@ -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},
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user