progressui: show warnings

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
master
Tonis Tiigi 2021-11-30 21:10:05 -08:00
parent 50963e289e
commit d100814aad
2 changed files with 26 additions and 0 deletions

View File

@ -140,6 +140,9 @@ type vertex struct {
count int
statusUpdates map[string]struct{}
warnings []client.VertexWarning
warningIdx int
jobs []*job
jobCached bool
@ -255,6 +258,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 {
@ -369,6 +380,16 @@ func (t *trace) displayInfo() (d displayInfo) {
}
jobs = append(jobs, j)
}
for _, w := range v.warnings {
msg := "WARN: " + string(w.Message)
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

View File

@ -125,6 +125,11 @@ func (p *textMux) printVtx(t *trace, dgst digest.Digest) {
}
v.statusUpdates = map[string]struct{}{}
for _, w := range v.warnings[v.warningIdx:] {
fmt.Fprintf(p.w, "#%d WARN: %s\n", v.index, w.Message)
v.warningIdx++
}
for i, l := range v.logs {
if i == 0 {
l = l[v.logsOffset:]