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: progress bar image name flashes on push #2965

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/internal/packager/images/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ func Push(ctx context.Context, cfg PushConfig) error {
registryURL = cfg.RegInfo.Address
)

progress := message.NewProgressBar(totalSize, fmt.Sprintf("Pushing %d images", len(toPush)))
defer progress.Close()

err = retry.Do(func() error {
c, _ := cluster.NewCluster()
if c != nil {
Expand All @@ -68,7 +65,8 @@ func Push(ctx context.Context, cfg PushConfig) error {
}
}

progress = message.NewProgressBar(totalSize, fmt.Sprintf("Pushing %d images", len(toPush)))
progress := message.NewProgressBar(totalSize, fmt.Sprintf("Pushing %d images", len(toPush)))
defer progress.Close()
pushOptions := createPushOpts(cfg, progress)

pushImage := func(img v1.Image, name string) error {
Expand Down Expand Up @@ -124,14 +122,13 @@ func Push(ctx context.Context, cfg PushConfig) error {
pushed = append(pushed, refInfo)
totalSize -= size
}
progress.Successf("Pushed %d images", len(cfg.ImageList))
return nil
}, retry.Context(ctx), retry.Attempts(uint(cfg.Retries)), retry.Delay(500*time.Millisecond))
if err != nil {
return err
}

progress.Successf("Pushed %d images", len(cfg.ImageList))

return nil
}

Expand Down