google / google/go-containerregistry

Report per-object progress through WithProgress

Open
#1,000 3 comments 0 reactions 0 assignees View on GitHub
lifecycle/frozen
Dominant language
Go
Stars
4k
Forks
686
Avg merge
2d 12h
Merged PRs (30d)
26

Description

Based on conversation in https://github.com/google/go-containerregistry/pull/967#issuecomment-825666791

It'd be nice to have `WithProgress` expose per-blob and per-manifest upload progress, to diagnose issues and provide a nice UX like you get with `docker pull`.

Off the top of my head we could add fields to [`v1.Update`](https://pkg.go.dev/github.com/google/go-containerregistry/pkg/v1#Update) to support this:

```go
type Update struct {
// existing fields
Total int64
Complete int64
Error error

// new fields
ObjectName string
ObjectTotal, ObjectComplete int64
}
```

(naming TBD)

Then when we [read and upload a blob using `progressReader`](https://github.com/google/go-containerregistry/blob/83f4080544c8578ec02b937c2a0a4dc07198916d/pkg/v1/remote/write.go#L325-L328), have each `progressReader` also take the name of the object it's reading, and count per-reader (blob) progress.

A caller that's only interested in the full overall progress, they should just be able to ignore the new per-object fields and consume `Total`/`Complete` as normal.

Manifests are uploaded in one request, so those won't get fine-grained progress updates, but they're small anyway.

cc @deitch

Contributor guide

Open the contributing guide

Research direction

Start with pkg/v1.Update and the WithProgress implementation in pkg/v1/remote/write.go, especially the progressReader used while reading and uploading blobs. Review the linked pull-request conversation before deciding the field names and update semantics. Done means blob progress identifies each object while overall Total and Complete remain usable, with manifests still reported as single-request uploads.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.