Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: package publish progress bar frozen at zero #2367

Merged
merged 3 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/pkg/oci/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ func NewOrasRemote(url string, platform ocispec.Platform, mods ...Modifier) (*Or
return o, nil
}

// SetProgressWriter sets the progress writer for the remote
func (o *OrasRemote) SetProgressWriter(bar helpers.ProgressWriter) {
o.Transport.ProgressBar = bar
o.repo.Client.(*auth.Client).Client.Transport = o.Transport
}

// ClearProgressWriter clears the progress writer for the remote
func (o *OrasRemote) ClearProgressWriter() {
o.Transport.ProgressBar = nil
o.repo.Client.(*auth.Client).Client.Transport = o.Transport
}

// Repo gives you access to the underlying remote repository
func (o *OrasRemote) Repo() *remote.Repository {
return o.repo
Expand Down
3 changes: 2 additions & 1 deletion src/pkg/zoci/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ func (r *Remote) PublishPackage(ctx context.Context, pkg *types.ZarfPackage, pat

progressBar := message.NewProgressBar(total, fmt.Sprintf("Publishing %s:%s", r.Repo().Reference.Repository, r.Repo().Reference.Reference))
defer progressBar.Stop()
r.Transport.ProgressBar = progressBar
r.SetProgressWriter(progressBar)
defer r.ClearProgressWriter()

publishedDesc, err := oras.Copy(ctx, src, root.Digest.String(), r.Repo(), "", copyOpts)
if err != nil {
Expand Down