From 287b22e992c3ba71fba1b3993bca1e6bafd99549 Mon Sep 17 00:00:00 2001 From: Danny Gershman Date: Wed, 5 Apr 2023 14:54:42 -0400 Subject: [PATCH] Adding additional details for debugging about registry pushes (#1558) ## 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 --- src/internal/packager/images/pull.go | 1 + src/internal/packager/images/push.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/internal/packager/images/pull.go b/src/internal/packager/images/pull.go index 63e872490b..c89b6b8950 100644 --- a/src/internal/packager/images/pull.go +++ b/src/internal/packager/images/pull.go @@ -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) } diff --git a/src/internal/packager/images/push.go b/src/internal/packager/images/push.go index 43bef8b9fd..241d52ef08 100644 --- a/src/internal/packager/images/push.go +++ b/src/internal/packager/images/push.go @@ -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 @@ -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))