From ed40bfd6895ae9e3bc2b076f4423183474b423a8 Mon Sep 17 00:00:00 2001 From: Andrei Aaron Date: Tue, 16 Dec 2025 00:03:24 +0200 Subject: [PATCH] fix: more logging for sync extension (#3656) Signed-off-by: Andrei Aaron --- pkg/extensions/extension_sync.go | 2 ++ pkg/extensions/sync/remote.go | 2 ++ pkg/extensions/sync/sync.go | 2 +- pkg/extensions/sync/sync_test.go | 2 +- test/blackbox/sync_harness.bats | 2 +- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/extensions/extension_sync.go b/pkg/extensions/extension_sync.go index 4041a7a4..eaaac39d 100644 --- a/pkg/extensions/extension_sync.go +++ b/pkg/extensions/extension_sync.go @@ -26,6 +26,8 @@ func EnableSyncExtension(config *config.Config, metaDB mTypes.MetaDB, httpPort := config.GetHTTPPort() if extensionsConfig.IsSyncEnabled() { + log.Info().Msg("sync extension is enabled") + onDemand := sync.NewOnDemand(log) syncConfig := extensionsConfig.GetSyncConfig() diff --git a/pkg/extensions/sync/remote.go b/pkg/extensions/sync/remote.go index 9e35bac4..f3186910 100644 --- a/pkg/extensions/sync/remote.go +++ b/pkg/extensions/sync/remote.go @@ -60,6 +60,8 @@ func (registry *RemoteRegistry) GetRepositories(ctx context.Context) ([]string, continue } + registry.log.Debug().Strs("repoList", repoList).Str("remote", host.Name).Msg("listed repositories in remote registry") + return repoList, nil } diff --git a/pkg/extensions/sync/sync.go b/pkg/extensions/sync/sync.go index eaf8adfe..52bff553 100644 --- a/pkg/extensions/sync/sync.go +++ b/pkg/extensions/sync/sync.go @@ -141,7 +141,7 @@ func (gen *TaskGenerator) Next() (scheduler.Task, error) { gen.resetWaitTime() if repo == "" { - gen.log.Info().Str("component", "sync").Msg("finished syncing all repositories") + gen.log.Info().Str("component", "sync").Msg("finished generating tasks to sync repositories") gen.done = true return nil, nil //nolint:nilnil diff --git a/pkg/extensions/sync/sync_test.go b/pkg/extensions/sync/sync_test.go index a6816b3a..f5eea5a1 100644 --- a/pkg/extensions/sync/sync_test.go +++ b/pkg/extensions/sync/sync_test.go @@ -7869,7 +7869,7 @@ func pushBlob(url string, repoName string, buf []byte) godigest.Digest { // this is waiting for generator to finish working, it doesn't mean sync has finished though. func waitSyncFinish(logPath string) bool { found, err := test.ReadLogFileAndSearchString(logPath, - "finished syncing all repos", 60*time.Second) + "finished generating tasks to sync repositories", 60*time.Second) if err != nil { panic(err) } diff --git a/test/blackbox/sync_harness.bats b/test/blackbox/sync_harness.bats index 24036c88..282592f9 100644 --- a/test/blackbox/sync_harness.bats +++ b/test/blackbox/sync_harness.bats @@ -126,7 +126,7 @@ function teardown() { start=`date +%s` echo "waiting for sync to finish" >&3 - run wait_for_string "finished syncing all repos" ${ZOT_LOG_FILE} "5m" + run wait_for_string "finished generating tasks to sync repositories" ${ZOT_LOG_FILE} "5m" [ "$status" -eq 0 ] end=`date +%s`