Skip to content

Commit

Permalink
Merge pull request moby#47432 from vvoland/c8d-pull-fslayer
Browse files Browse the repository at this point in the history
c8d/pull: Progress fixes
thaJeztah authored Feb 26, 2024
2 parents 0eecd59 + 14df52b commit c70d790
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions daemon/containerd/image_pull.go
Original file line number Diff line number Diff line change
@@ -117,6 +117,9 @@ func (i *ImageService) pullTag(ctx context.Context, ref reference.Named, platfor
progress.Message(out, "", distribution.DeprecatedSchema1ImageMessage(ref))
sentSchema1Deprecation = true
}
if images.IsLayerType(desc.MediaType) {
progress.Update(out, desc.Digest.String(), "Pulling fs layer")
}
if images.IsManifestType(desc.MediaType) {
if !sentPullingFrom {
var tagOrDigest string
3 changes: 3 additions & 0 deletions daemon/containerd/progress.go
Original file line number Diff line number Diff line change
@@ -135,6 +135,9 @@ func (p pullProgress) UpdateProgress(ctx context.Context, ongoing *jobs, out pro
}
key := remotes.MakeRefKey(ctx, j)
if info, ok := pulling[key]; ok {
if info.Offset == 0 {
continue
}
out.WriteProgress(progress.Progress{
ID: stringid.TruncateID(j.Digest.Encoded()),
Action: "Downloading",
5 changes: 5 additions & 0 deletions pkg/streamformatter/streamformatter.go
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"io"
"sync"

"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/pkg/progress"
@@ -109,6 +110,7 @@ type progressOutput struct {
sf formatProgress
out io.Writer
newLines bool
mu sync.Mutex
}

// WriteProgress formats progress information from a ProgressReader.
@@ -120,6 +122,9 @@ func (out *progressOutput) WriteProgress(prog progress.Progress) error {
jsonProgress := jsonmessage.JSONProgress{Current: prog.Current, Total: prog.Total, HideCounts: prog.HideCounts, Units: prog.Units}
formatted = out.sf.formatProgress(prog.ID, prog.Action, &jsonProgress, prog.Aux)
}

out.mu.Lock()
defer out.mu.Unlock()
_, err := out.out.Write(formatted)
if err != nil {
return err

0 comments on commit c70d790

Please sign in to comment.