Skip to content

Commit

Permalink
added progress bar to ear
Browse files Browse the repository at this point in the history
  • Loading branch information
dbw7 committed Apr 5, 2024
1 parent d940dfe commit 90472ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## General

* Added a progress bar showing the progress of pulling images into the embedded artifact registry

## API

### Image Definition Changes
Expand Down
9 changes: 8 additions & 1 deletion pkg/combustion/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"slices"
"strings"

"github.com/schollz/progressbar/v3"

"gopkg.in/yaml.v3"

"github.com/suse-edge/edge-image-builder/pkg/fileio"
Expand Down Expand Up @@ -360,7 +362,8 @@ func registryArtefactsPath(ctx *image.Context) string {
}

func populateRegistry(ctx *image.Context, images []string) error {
log.Audit("Populating Embedded Artifact Registry...")
bar := progressbar.Default(int64(len(images)), "Populating Embedded Artifact Registry...")

for _, i := range images {
if err := addImageToHauler(ctx, i); err != nil {
return fmt.Errorf("adding image to hauler: %w", err)
Expand All @@ -373,6 +376,10 @@ func populateRegistry(ctx *image.Context, images []string) error {
if err := generateRegistryTar(ctx, imageTarDest); err != nil {
return fmt.Errorf("generating hauler store tar: %w", err)
}

if err := bar.Add(1); err != nil {
zap.S().Errorf("Error incrementing the progress bar: %s", err)
}
}

return nil
Expand Down

0 comments on commit 90472ba

Please sign in to comment.