vendor: update buildkit to 539be170

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2021-12-15 22:09:13 -08:00
parent 59533bbb5c
commit 9c3be32bc9
581 changed files with 24648 additions and 16682 deletions

View File

@ -21,8 +21,7 @@ import (
"golang.org/x/time/rate"
)
func DisplaySolveStatus(ctx context.Context, phase string, c console.Console, w io.Writer, ch chan *client.SolveStatus) error {
func DisplaySolveStatus(ctx context.Context, phase string, c console.Console, w io.Writer, ch chan *client.SolveStatus) ([]client.VertexWarning, error) {
modeConsole := c != nil
disp := &display{c: c, phase: phase}
@ -46,7 +45,10 @@ func DisplaySolveStatus(ctx context.Context, phase string, c console.Console, w
var done bool
ticker := time.NewTicker(tickerTimeout)
defer ticker.Stop()
// implemented as closure because "ticker" can change
defer func() {
ticker.Stop()
}()
displayLimiter := rate.NewLimiter(rate.Every(displayTimeout), 1)
@ -55,7 +57,7 @@ func DisplaySolveStatus(ctx context.Context, phase string, c console.Console, w
for {
select {
case <-ctx.Done():
return ctx.Err()
return nil, ctx.Err()
case <-ticker.C:
case ss, ok := <-ch:
if ok {
@ -70,7 +72,7 @@ func DisplaySolveStatus(ctx context.Context, phase string, c console.Console, w
if done {
disp.print(t.displayInfo(), width, height, true)
t.printErrorLogs(c)
return nil
return t.warnings(), nil
} else if displayLimiter.Allow() {
ticker.Stop()
ticker = time.NewTicker(tickerTimeout)
@ -81,7 +83,7 @@ func DisplaySolveStatus(ctx context.Context, phase string, c console.Console, w
printer.print(t)
if done {
t.printErrorLogs(w)
return nil
return t.warnings(), nil
}
ticker.Stop()
ticker = time.NewTicker(tickerTimeout)
@ -138,6 +140,9 @@ type vertex struct {
count int
statusUpdates map[string]struct{}
warnings []client.VertexWarning
warningIdx int
jobs []*job
jobCached bool
@ -167,6 +172,14 @@ func newTrace(w io.Writer, modeConsole bool) *trace {
}
}
func (t *trace) warnings() []client.VertexWarning {
var out []client.VertexWarning
for _, v := range t.vertexes {
out = append(out, v.warnings...)
}
return out
}
func (t *trace) triggerVertexEvent(v *client.Vertex) {
if v.Started == nil {
return
@ -253,6 +266,14 @@ func (t *trace) update(s *client.SolveStatus, termWidth int) {
t.updates[v.Digest] = struct{}{}
v.update(1)
}
for _, w := range s.Warnings {
v, ok := t.byDigest[w.Vertex]
if !ok {
continue // shouldn't happen
}
v.warnings = append(v.warnings, *w)
v.update(1)
}
for _, l := range s.Logs {
v, ok := t.byDigest[l.Vertex]
if !ok {
@ -367,6 +388,16 @@ func (t *trace) displayInfo() (d displayInfo) {
}
jobs = append(jobs, j)
}
for _, w := range v.warnings {
msg := "WARN: " + string(w.Short)
j := &job{
startTime: addTime(v.Started, t.localTimeDiff),
completedTime: addTime(v.Completed, t.localTimeDiff),
name: msg,
isCanceled: true,
}
jobs = append(jobs, j)
}
d.jobs = append(d.jobs, jobs...)
v.jobs = jobs
v.jobCached = true