Skip to content

Commit 588450f

Browse files
committed
wip
Signed-off-by: Kit Patella <[email protected]>
1 parent d725ed4 commit 588450f

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

src/pkg/layout/package.go

+2-10
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"github.com/zarf-dev/zarf/src/api/v1alpha1"
2222
"github.com/zarf-dev/zarf/src/pkg/interactive"
2323
"github.com/zarf-dev/zarf/src/pkg/logger"
24-
"github.com/zarf-dev/zarf/src/pkg/message"
2524
"github.com/zarf-dev/zarf/src/pkg/packager/deprecated"
2625
"github.com/zarf-dev/zarf/src/pkg/utils"
2726
)
@@ -230,26 +229,19 @@ func (pp *PackagePaths) GenerateChecksums() (string, error) {
230229
// ArchivePackage creates an archive for a Zarf package.
231230
func (pp *PackagePaths) ArchivePackage(ctx context.Context, destinationTarball string, maxPackageSizeMB int) error {
232231
l := logger.From(ctx)
233-
// TODO(mkcp): Remove message on logger release
234-
spinner := message.NewProgressSpinner("Writing %s to %s", pp.Base, destinationTarball)
235-
defer spinner.Stop()
236232
l.Info("archiving zarf package", "base", pp.Base, "destination", destinationTarball)
237233

238234
// Make the archive
239235
archiveSrc := []string{pp.Base + string(os.PathSeparator)}
240236
if err := archiver.Archive(archiveSrc, destinationTarball); err != nil {
241237
return fmt.Errorf("unable to create package: %w", err)
242238
}
243-
// TODO(mkcp): Remove message on logger release
244-
spinner.Updatef("Wrote %s to %s", pp.Base, destinationTarball)
245239
l.Debug("ArchivePackage wrote", "base", pp.Base, "destination", destinationTarball)
246240

247241
fi, err := os.Stat(destinationTarball)
248242
if err != nil {
249243
return fmt.Errorf("unable to read the package archive: %w", err)
250244
}
251-
// TODO(mkcp): Remove message on logger release
252-
spinner.Successf("Package saved to %q", destinationTarball)
253245
l.Debug("package saved", "destination", destinationTarball)
254246

255247
// Convert Megabytes to bytes.
@@ -260,7 +252,6 @@ func (pp *PackagePaths) ArchivePackage(ctx context.Context, destinationTarball s
260252
if fi.Size()/int64(chunkSize) > 999 {
261253
return fmt.Errorf("unable to split the package archive into multiple files: must be less than 1,000 files")
262254
}
263-
message.Notef("Package is larger than %dMB, splitting into multiple files", maxPackageSizeMB)
264255
l.Info("package is larger than max, splitting into multiple files", "maxPackageSize", maxPackageSizeMB)
265256
err := splitFile(ctx, destinationTarball, chunkSize)
266257
if err != nil {
@@ -342,7 +333,8 @@ func (pp *PackagePaths) Files() map[string]string {
342333
stripBase := func(path string) string {
343334
rel, err := filepath.Rel(pp.Base, path)
344335
if err != nil {
345-
message.Debug("unable to strip base from path", "error", err)
336+
// HACK(mkcp): Source this logger from ctx chain instead or this logging behavior gets weird in testing.
337+
logger.Default().Debug("unable to strip base from path", "error", err)
346338
}
347339
// Convert from the OS path separator to the standard '/' for Windows support
348340
return filepath.ToSlash(rel)

src/pkg/layout/package_test.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package layout
66

77
import (
8-
"context"
98
"path/filepath"
109
"runtime"
1110
"strings"
@@ -36,7 +35,6 @@ func TestPackageFiles(t *testing.T) {
3635

3736
t.Run("Verify Files()", func(t *testing.T) {
3837
t.Parallel()
39-
4038
pp := New("test")
4139

4240
files := pp.Files()
@@ -104,7 +102,7 @@ func TestPackageFiles(t *testing.T) {
104102

105103
t.Run("Verify Files() with paths mapped to package paths", func(t *testing.T) {
106104
t.Parallel()
107-
ctx := context.Background()
105+
ctx := t.Context()
108106

109107
pp := New("test")
110108

@@ -136,7 +134,7 @@ func TestPackageFiles(t *testing.T) {
136134

137135
t.Run("Verify Files() with image layers mapped to package paths", func(t *testing.T) {
138136
t.Parallel()
139-
ctx := context.Background()
137+
ctx := t.Context()
140138

141139
pp := New("test")
142140

0 commit comments

Comments
 (0)