Skip to content

Commit

Permalink
progressui: show warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Tonis Tiigi <[email protected]>
  • Loading branch information
tonistiigi committed Dec 1, 2021
1 parent 50963e2 commit d100814
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
21 changes: 21 additions & 0 deletions util/progress/progressui/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ type vertex struct {
count int
statusUpdates map[string]struct{}

warnings []client.VertexWarning
warningIdx int

jobs []*job
jobCached bool

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions util/progress/progressui/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:]
Expand Down

0 comments on commit d100814

Please sign in to comment.