Skip to content

Commit 62c9042

Browse files
authored
Merge pull request #335 from ndeloof/bump_moby_cli
Format layer progress details with minimal efforts as new UI does not render individual layers
2 parents fae6d96 + f7cc8d5 commit 62c9042

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pkg/compose/pull.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"github.com/distribution/reference"
3333
"github.com/docker/cli/cli/config/configfile"
3434
clitypes "github.com/docker/cli/cli/config/types"
35+
"github.com/docker/go-units"
3536
"github.com/moby/moby/api/types/jsonstream"
3637
"github.com/moby/moby/client"
3738
"github.com/opencontainers/go-digest"
@@ -414,16 +415,13 @@ func toPullProgressEvent(parent string, jm jsonstream.Message, events api.EventP
414415
}
415416

416417
var (
417-
progress string
418-
total int64
419-
percent int
420-
current int64
421-
status = api.Working
418+
details string
419+
total int64
420+
percent int
421+
current int64
422+
status = api.Working
422423
)
423424

424-
// FIXME(thaJeztah): what's the replacement for Progress.String()?
425-
// progress = jm.Progress.String()
426-
427425
switch jm.Status {
428426
case PreparingPhase, WaitingPhase, PullingFsPhase:
429427
percent = 0
@@ -451,7 +449,9 @@ func toPullProgressEvent(parent string, jm jsonstream.Message, events api.EventP
451449

452450
if jm.Error != nil {
453451
status = api.Error
454-
progress = jm.Error.Message
452+
details = jm.Error.Message
453+
} else {
454+
details = units.HumanSize(float64(jm.Progress.Current))
455455
}
456456

457457
events.On(api.Resource{
@@ -462,6 +462,6 @@ func toPullProgressEvent(parent string, jm jsonstream.Message, events api.EventP
462462
Percent: percent,
463463
Status: status,
464464
Text: jm.Status,
465-
Details: progress,
465+
Details: details,
466466
})
467467
}

0 commit comments

Comments
 (0)