Skip to content

Commit f80cf30

Browse files
committed
Merge branch 'main' into fixed-cmd-precedents
2 parents c146b46 + bd70379 commit f80cf30

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

cmd/hauler/cli/store/add.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ func storeLocalImage(ctx context.Context, s *store.Layout, i v1.Image, _ *flags.
389389
start := time.Now()
390390
ignoreErrors := flags.ShouldIgnoreErrors(ro)
391391

392-
l.Debugf("adding image [%s] from local Docker daemon to the store", i.Name)
392+
l.Debugf("resolving image [%s] from local Docker daemon (rewrite=%q)", i.Name, rewrite)
393393

394394
r, err := name.ParseReference(i.Name)
395395
if err != nil {
@@ -480,7 +480,10 @@ func storeImage(ctx context.Context, s *store.Layout, i v1.Image, platform strin
480480
return err
481481
}
482482

483-
log.BaseFromContext(ctx).Debugf("adding image [%s] to the store", i.Name)
483+
insecureSkipTLSVerify := i.InsecureSkipTLSVerify
484+
caFile := i.CaFile
485+
486+
log.BaseFromContext(ctx).Debugf("resolving image [%s] (verified=%t, platform=%q, excludeExtras=%t, insecureSkipTLSVerify=%t, caFile=%q, rewrite=%q, digest=%q)", i.Name, verified, platform, excludeExtras, insecureSkipTLSVerify, caFile, rewrite, pinnedDigest)
484487

485488
r, err := name.ParseReference(i.Name)
486489
if err != nil {
@@ -493,9 +496,6 @@ func storeImage(ctx context.Context, s *store.Layout, i v1.Image, platform strin
493496
}
494497
}
495498

496-
insecureSkipTLSVerify := i.InsecureSkipTLSVerify
497-
caFile := i.CaFile
498-
499499
// fetch image along with any associated signatures and attestations.
500500
// A fresh store.ImageStats is built inside the closure on every attempt,
501501
// not once outside it, so a failed attempt's partial layer/byte counts

cmd/hauler/cli/store/sync_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2111,7 +2111,7 @@ func TestSyncImages_ErrorPropagation(t *testing.T) {
21112111
// goroutine has fully returned (including cancelling gctx on failure), so
21122112
// jobs run strictly in slice order and the good jobs are guaranteed to
21132113
// observe the already-cancelled context before doing anything.
2114-
func TestRunImageJobs_CancelledJobsDoNotLogAddingImage(t *testing.T) {
2114+
func TestRunImageJobs_CancelledJobsDoNotLogResolvingImage(t *testing.T) {
21152115
host, remoteOpts := newTestRegistry(t)
21162116

21172117
const nGood = 3
@@ -2125,8 +2125,9 @@ func TestRunImageJobs_CancelledJobsDoNotLogAddingImage(t *testing.T) {
21252125

21262126
s := newTestStore(t)
21272127
var buf bytes.Buffer
2128-
// "adding image [...]" now logs at Debug (cmd/hauler/cli/store/add.go),
2129-
// so this test needs Debug-level output visible. Per-logger .Level() is
2128+
// "resolving image [...]" (storeImage's per-job startup line in
2129+
// cmd/hauler/cli/store/add.go) logs at Debug, so this test needs
2130+
// Debug-level output visible. Per-logger .Level() is
21302131
// not sufficient on its own: zerolog's Logger.should() gates on
21312132
// max(logger.level, zerolog.GlobalLevel()) -- and GlobalLevel is
21322133
// process-global state that other tests in this package mutate (e.g.
@@ -2151,9 +2152,9 @@ func TestRunImageJobs_CancelledJobsDoNotLogAddingImage(t *testing.T) {
21512152
t.Fatal("runImageJobs: expected error, got nil")
21522153
}
21532154

2154-
got := strings.Count(buf.String(), "adding image [")
2155+
got := strings.Count(buf.String(), "resolving image [")
21552156
if got != 1 {
2156-
t.Errorf("\"adding image [\" logged %d times, want exactly 1 (only the failed job should have attempted logging; the %d good jobs queued after it must never start)\nfull log:\n%s", got, nGood, buf.String())
2157+
t.Errorf("\"resolving image [\" logged %d times, want exactly 1 (only the failed job should have attempted logging; the %d good jobs queued after it must never start)\nfull log:\n%s", got, nGood, buf.String())
21572158
}
21582159
}
21592160

0 commit comments

Comments
 (0)