Skip to content

Commit

Permalink
Embedded artifact registry progress bar (#357)
Browse files Browse the repository at this point in the history
* added progress bar to ear

* updates based on feedback
  • Loading branch information
dbw7 authored Apr 8, 2024
1 parent 3bc1dc0 commit 922d269
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
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
11 changes: 8 additions & 3 deletions pkg/combustion/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
"slices"
"strings"

"gopkg.in/yaml.v3"

"github.com/schollz/progressbar/v3"
"github.com/suse-edge/edge-image-builder/pkg/fileio"
"github.com/suse-edge/edge-image-builder/pkg/image"
"github.com/suse-edge/edge-image-builder/pkg/log"
"github.com/suse-edge/edge-image-builder/pkg/registry"
"github.com/suse-edge/edge-image-builder/pkg/template"
"go.uber.org/zap"
"gopkg.in/yaml.v3"
)

const (
Expand Down Expand Up @@ -360,7 +360,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 +374,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().Debugf("Error incrementing the progress bar: %s", err)
}
}

return nil
Expand Down

0 comments on commit 922d269

Please sign in to comment.