vendor: update buildkit

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2022-03-08 10:53:06 -08:00
parent a7fba7bf3a
commit d7412c9420
29 changed files with 1535 additions and 980 deletions

View File

@ -27,10 +27,11 @@ type lastStatus struct {
}
type textMux struct {
w io.Writer
current digest.Digest
last map[string]lastStatus
notFirst bool
w io.Writer
current digest.Digest
last map[string]lastStatus
notFirst bool
nextIndex int
}
func (p *textMux) printVtx(t *trace, dgst digest.Digest) {
@ -43,6 +44,11 @@ func (p *textMux) printVtx(t *trace, dgst digest.Digest) {
return
}
if v.index == 0 {
p.nextIndex++
v.index = p.nextIndex
}
if dgst != p.current {
if p.current != "" {
old := t.byDigest[p.current]
@ -75,6 +81,7 @@ func (p *textMux) printVtx(t *trace, dgst digest.Digest) {
}
v.events = v.events[:0]
isOpenStatus := false // remote cache loading can currently produce status updates without active vertex
for _, s := range v.statuses {
if _, ok := v.statusUpdates[s.ID]; ok {
doPrint := true
@ -118,6 +125,8 @@ func (p *textMux) printVtx(t *trace, dgst digest.Digest) {
}
if s.Completed != nil {
tm += " done"
} else {
isOpenStatus = true
}
fmt.Fprintf(p.w, "#%d %s%s%s\n", v.index, s.ID, bytes, tm)
}
@ -157,7 +166,7 @@ func (p *textMux) printVtx(t *trace, dgst digest.Digest) {
}
p.current = dgst
if v.Completed != nil {
if v.isCompleted() && !isOpenStatus {
p.current = ""
v.count = 0
@ -174,8 +183,17 @@ func (p *textMux) printVtx(t *trace, dgst digest.Digest) {
fmt.Fprintf(p.w, "#%d CACHED\n", v.index)
} else {
tm := ""
if v.Started != nil {
tm = fmt.Sprintf(" %.1fs", v.Completed.Sub(*v.Started).Seconds())
var ivals []interval
for _, ival := range v.intervals {
ivals = append(ivals, ival)
}
ivals = mergeIntervals(ivals)
if len(ivals) > 0 {
var dt float64
for _, ival := range ivals {
dt += ival.duration().Seconds()
}
tm = fmt.Sprintf(" %.1fs", dt)
}
fmt.Fprintf(p.w, "#%d DONE%s\n", v.index, tm)
}
@ -190,7 +208,9 @@ func sortCompleted(t *trace, m map[digest.Digest]struct{}) []digest.Digest {
out = append(out, k)
}
sort.Slice(out, func(i, j int) bool {
return t.byDigest[out[i]].Completed.Before(*t.byDigest[out[j]].Completed)
vtxi := t.byDigest[out[i]]
vtxj := t.byDigest[out[j]]
return vtxi.mostRecentInterval().stop.Before(*vtxj.mostRecentInterval().stop)
})
return out
}
@ -204,7 +224,11 @@ func (p *textMux) print(t *trace) {
if !ok {
continue
}
if v.Vertex.Completed != nil {
if v.ProgressGroup != nil || v.hidden {
// skip vtxs in a group (they are merged into a single vtx) and hidden ones
continue
}
if v.isCompleted() {
completed[dgst] = struct{}{}
} else {
rest[dgst] = struct{}{}
@ -226,13 +250,13 @@ func (p *textMux) print(t *trace) {
if len(rest) == 0 {
if current != "" {
if v := t.byDigest[current]; v.Started != nil && v.Completed == nil {
if v := t.byDigest[current]; v.isStarted() && !v.isCompleted() {
return
}
}
// make any open vertex active
for dgst, v := range t.byDigest {
if v.Started != nil && v.Completed == nil {
if v.isStarted() && !v.isCompleted() {
p.printVtx(t, dgst)
return
}