Skip to content

Commit

Permalink
Adding additional details for debugging about registry pushes (#1558)
Browse files Browse the repository at this point in the history
## Description

This enables some additional logging information for pushes to
registries.

## Related Issue

Relates to #1218 

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [ ] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/CONTRIBUTING.md#developer-workflow)
followed
  • Loading branch information
dgershman authored Apr 5, 2023
1 parent 485e434 commit 287b22e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/internal/packager/images/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (i *ImgConfig) PullAll() error {
defer spinner.Stop()

if message.GetLogLevel() >= message.DebugLevel {
spinner.EnablePreserveWrites()
logs.Warn.SetOutput(spinner)
logs.Progress.SetOutput(spinner)
}
Expand Down
7 changes: 7 additions & 0 deletions src/internal/packager/images/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/defenseunicorns/zarf/src/pkg/message"
"github.com/defenseunicorns/zarf/src/pkg/utils"
"github.com/google/go-containerregistry/pkg/crane"
"github.com/google/go-containerregistry/pkg/logs"
)

// PushToZarfRegistry pushes a provided image into the configured Zarf registry
Expand Down Expand Up @@ -52,6 +53,12 @@ func (i *ImgConfig) PushToZarfRegistry() error {
spinner := message.NewProgressSpinner("Storing images in the zarf registry")
defer spinner.Stop()

if message.GetLogLevel() >= message.DebugLevel {
spinner.EnablePreserveWrites()
logs.Warn.SetOutput(spinner)
logs.Progress.SetOutput(spinner)
}

pushOptions := config.GetCraneOptions(i.Insecure, i.Architectures...)
pushOptions = append(pushOptions, config.GetCraneAuthOption(i.RegInfo.PushUsername, i.RegInfo.PushPassword))

Expand Down

0 comments on commit 287b22e

Please sign in to comment.