mirror of
https://github.com/project-zot/zot.git
synced 2024-12-16 21:56:37 -05:00
feat: remove usage of zerolog.Logger.Msgf() from zot code (#1382)
Signed-off-by: Nicol Draghici <idraghic@cisco.com>
This commit is contained in:
parent
40bf76add5
commit
c169698c95
29 changed files with 354 additions and 294 deletions
|
@ -297,8 +297,8 @@ func (c *Controller) InitImageStore(ctx context.Context) error {
|
|||
} else {
|
||||
storeName := fmt.Sprintf("%v", c.Config.Storage.StorageDriver["name"])
|
||||
if storeName != storage.S3StorageDriverName {
|
||||
c.Log.Fatal().Err(errors.ErrBadConfig).Msgf("unsupported storage driver: %s",
|
||||
c.Config.Storage.StorageDriver["name"])
|
||||
c.Log.Fatal().Err(errors.ErrBadConfig).Str("storageDriver", storeName).
|
||||
Msg("unsupported storage driver")
|
||||
}
|
||||
// Init a Storager from connection string.
|
||||
store, err := factory.Create(storeName, c.Config.Storage.StorageDriver)
|
||||
|
@ -405,7 +405,8 @@ func (c *Controller) getSubStore(subPaths map[string]config.StorageConfig,
|
|||
} else {
|
||||
storeName := fmt.Sprintf("%v", storageConfig.StorageDriver["name"])
|
||||
if storeName != storage.S3StorageDriverName {
|
||||
c.Log.Fatal().Err(errors.ErrBadConfig).Msgf("unsupported storage driver: %s", storageConfig.StorageDriver["name"])
|
||||
c.Log.Fatal().Err(errors.ErrBadConfig).Str("storageDriver", storeName).
|
||||
Msg("unsupported storage driver")
|
||||
}
|
||||
|
||||
// Init a Storager from connection string.
|
||||
|
|
|
@ -411,7 +411,7 @@ func (rh *RouteHandler) GetManifest(response http.ResponseWriter, request *http.
|
|||
err := meta.OnGetManifest(name, reference, digest, content, rh.c.StoreController, rh.c.RepoDB, rh.c.Log)
|
||||
|
||||
if errors.Is(err, zerr.ErrOrphanSignature) {
|
||||
rh.c.Log.Error().Err(err).Msgf("image is an orphan signature")
|
||||
rh.c.Log.Error().Err(err).Msg("image is an orphan signature")
|
||||
} else if err != nil {
|
||||
response.WriteHeader(http.StatusInternalServerError)
|
||||
|
||||
|
@ -438,8 +438,8 @@ func getReferrers(ctx context.Context, routeHandler *RouteHandler,
|
|||
if routeHandler.c.Config.Extensions != nil &&
|
||||
routeHandler.c.Config.Extensions.Sync != nil &&
|
||||
*routeHandler.c.Config.Extensions.Sync.Enable {
|
||||
routeHandler.c.Log.Info().Msgf("referrers not found, trying to get referrers to %s:%s by syncing on demand",
|
||||
name, digest)
|
||||
routeHandler.c.Log.Info().Str("repository", name).Str("reference", digest.String()).
|
||||
Msg("referrers not found, trying to get reference by syncing on demand")
|
||||
|
||||
errSync := ext.SyncOneImage(ctx, routeHandler.c.Config, routeHandler.c.RepoDB, routeHandler.c.StoreController,
|
||||
name, digest.String(), sync.OCIReference, routeHandler.c.Log)
|
||||
|
@ -598,7 +598,8 @@ func (rh *RouteHandler) UpdateManifest(response http.ResponseWriter, request *ht
|
|||
// deletion of image manifest is important, but not critical for image repo consistancy
|
||||
// in the worst scenario a partial manifest file written to disk will not affect the repo because
|
||||
// the new manifest was not added to "index.json" file (it is possible that GC will take care of it)
|
||||
rh.c.Log.Error().Err(err).Msgf("couldn't remove image manifest %s in repo %s", reference, name)
|
||||
rh.c.Log.Error().Err(err).Str("repository", name).Str("reference", reference).
|
||||
Msg("couldn't remove image manifest in repo")
|
||||
}
|
||||
|
||||
response.WriteHeader(http.StatusInternalServerError)
|
||||
|
@ -611,7 +612,7 @@ func (rh *RouteHandler) UpdateManifest(response http.ResponseWriter, request *ht
|
|||
err := meta.OnUpdateManifest(name, reference, mediaType, digest, body, rh.c.StoreController, rh.c.RepoDB,
|
||||
rh.c.Log)
|
||||
if errors.Is(err, zerr.ErrOrphanSignature) {
|
||||
rh.c.Log.Error().Err(err).Msgf("pushed image is an orphan signature")
|
||||
rh.c.Log.Error().Err(err).Msg("pushed image is an orphan signature")
|
||||
} else if err != nil {
|
||||
response.WriteHeader(http.StatusInternalServerError)
|
||||
|
||||
|
@ -710,7 +711,7 @@ func (rh *RouteHandler) DeleteManifest(response http.ResponseWriter, request *ht
|
|||
err := meta.OnDeleteManifest(name, reference, mediaType, manifestDigest, manifestBlob,
|
||||
rh.c.StoreController, rh.c.RepoDB, rh.c.Log)
|
||||
if errors.Is(err, zerr.ErrOrphanSignature) {
|
||||
rh.c.Log.Error().Err(err).Msgf("pushed image is an orphan signature")
|
||||
rh.c.Log.Error().Err(err).Msg("pushed image is an orphan signature")
|
||||
} else if err != nil {
|
||||
response.WriteHeader(http.StatusInternalServerError)
|
||||
|
||||
|
@ -1274,7 +1275,8 @@ func (rh *RouteHandler) PatchBlobUpload(response http.ResponseWriter, request *h
|
|||
rh.c.Log.Error().Err(err).Msg("unexpected error: removing .uploads/ files")
|
||||
|
||||
if err = imgStore.DeleteBlobUpload(name, sessionID); err != nil {
|
||||
rh.c.Log.Error().Err(err).Msgf("couldn't remove blobUpload %s in repo %s", sessionID, name)
|
||||
rh.c.Log.Error().Err(err).Str("blobUpload", sessionID).Str("repository", name).
|
||||
Msg("couldn't remove blobUpload in repo")
|
||||
}
|
||||
response.WriteHeader(http.StatusInternalServerError)
|
||||
}
|
||||
|
@ -1393,7 +1395,8 @@ func (rh *RouteHandler) UpdateBlobUpload(response http.ResponseWriter, request *
|
|||
rh.c.Log.Error().Err(err).Msg("unexpected error: removing .uploads/ files")
|
||||
|
||||
if err = imgStore.DeleteBlobUpload(name, sessionID); err != nil {
|
||||
rh.c.Log.Error().Err(err).Msgf("couldn't remove blobUpload %s in repo %s", sessionID, name)
|
||||
rh.c.Log.Error().Err(err).Str("blobUpload", sessionID).Str("repository", name).
|
||||
Msg("couldn't remove blobUpload in repo")
|
||||
}
|
||||
response.WriteHeader(http.StatusInternalServerError)
|
||||
}
|
||||
|
@ -1422,7 +1425,8 @@ finish:
|
|||
rh.c.Log.Error().Err(err).Msg("unexpected error: removing .uploads/ files")
|
||||
|
||||
if err = imgStore.DeleteBlobUpload(name, sessionID); err != nil {
|
||||
rh.c.Log.Error().Err(err).Msgf("couldn't remove blobUpload %s in repo %s", sessionID, name)
|
||||
rh.c.Log.Error().Err(err).Str("blobUpload", sessionID).Str("repository", name).
|
||||
Msg("couldn't remove blobUpload in repo")
|
||||
}
|
||||
response.WriteHeader(http.StatusInternalServerError)
|
||||
}
|
||||
|
@ -1654,14 +1658,14 @@ func getImageManifest(ctx context.Context, routeHandler *RouteHandler, imgStore
|
|||
}
|
||||
|
||||
if syncEnabled {
|
||||
routeHandler.c.Log.Info().Msgf("trying to get updated image %s:%s by syncing on demand",
|
||||
name, reference)
|
||||
routeHandler.c.Log.Info().Str("repository", name).Str("reference", reference).
|
||||
Msg("trying to get updated image by syncing on demand")
|
||||
|
||||
errSync := ext.SyncOneImage(ctx, routeHandler.c.Config, routeHandler.c.RepoDB, routeHandler.c.StoreController,
|
||||
name, reference, "", routeHandler.c.Log)
|
||||
if errSync != nil {
|
||||
routeHandler.c.Log.Err(errSync).Msgf("error encounter while syncing image %s:%s",
|
||||
name, reference)
|
||||
routeHandler.c.Log.Err(errSync).Str("repository", name).Str("reference", reference).
|
||||
Msg("error encounter while syncing image")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1678,8 +1682,8 @@ func getOrasReferrers(ctx context.Context, routeHandler *RouteHandler,
|
|||
if routeHandler.c.Config.Extensions != nil &&
|
||||
routeHandler.c.Config.Extensions.Sync != nil &&
|
||||
*routeHandler.c.Config.Extensions.Sync.Enable {
|
||||
routeHandler.c.Log.Info().Msgf("artifact not found, trying to get artifact %s:%s by syncing on demand",
|
||||
name, digest.String())
|
||||
routeHandler.c.Log.Info().Str("repository", name).Str("reference", digest.String()).
|
||||
Msg("artifact not found, trying to get artifact by syncing on demand")
|
||||
|
||||
errSync := ext.SyncOneImage(ctx, routeHandler.c.Config, routeHandler.c.RepoDB, routeHandler.c.StoreController,
|
||||
name, digest.String(), sync.OrasArtifact, routeHandler.c.Log)
|
||||
|
|
|
@ -65,14 +65,14 @@ func (hr *HotReloader) Start() context.Context {
|
|||
}
|
||||
// watch for errors
|
||||
case err := <-hr.watcher.Errors:
|
||||
log.Error().Err(err).Msgf("fsnotfy error while watching config %s", hr.filePath)
|
||||
log.Error().Err(err).Str("config", hr.filePath).Msg("fsnotfy error while watching config")
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
if err := hr.watcher.Add(hr.filePath); err != nil {
|
||||
log.Error().Err(err).Msgf("error adding config file %s to FsNotify watcher", hr.filePath)
|
||||
log.Error().Err(err).Str("config", hr.filePath).Msg("error adding config file to FsNotify watcher")
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
|
|
@ -143,11 +143,11 @@ func newVerifyCmd(conf *config.Config) *cobra.Command {
|
|||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if len(args) > 0 {
|
||||
if err := LoadConfiguration(conf, args[0]); err != nil {
|
||||
log.Error().Msgf("Config file %s is invalid", args[0])
|
||||
log.Error().Str("config", args[0]).Msg("Config file is invalid")
|
||||
panic(err)
|
||||
}
|
||||
|
||||
log.Info().Msgf("Config file %s is valid", args[0])
|
||||
log.Info().Str("config", args[0]).Msg("Config file is valid")
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -263,16 +263,17 @@ func validateCacheConfig(cfg *config.Config) error {
|
|||
|
||||
// unsupported cache driver
|
||||
if cfg.Storage.CacheDriver["name"] != storageConstants.DynamoDBDriverName {
|
||||
log.Error().Err(errors.ErrBadConfig).Msgf("unsupported cache driver: %s", cfg.Storage.CacheDriver["name"])
|
||||
log.Error().Err(errors.ErrBadConfig).
|
||||
Interface("cacheDriver", cfg.Storage.CacheDriver["name"]).Msg("unsupported cache driver")
|
||||
|
||||
return errors.ErrBadConfig
|
||||
}
|
||||
}
|
||||
|
||||
if !cfg.Storage.RemoteCache && cfg.Storage.CacheDriver != nil {
|
||||
log.Warn().Err(errors.ErrBadConfig).Msgf(
|
||||
"remoteCache set to false but cacheDriver config (remote caching) provided for %s,"+
|
||||
"will ignore and use local caching", cfg.Storage.RootDirectory)
|
||||
log.Warn().Err(errors.ErrBadConfig).Str("directory", cfg.Storage.RootDirectory).
|
||||
Msg("remoteCache set to false but cacheDriver config (remote caching) provided for directory" +
|
||||
"will ignore and use local caching")
|
||||
}
|
||||
|
||||
// subpaths
|
||||
|
@ -295,16 +296,17 @@ func validateCacheConfig(cfg *config.Config) error {
|
|||
|
||||
// unsupported cache driver
|
||||
if subPath.CacheDriver["name"] != storageConstants.DynamoDBDriverName {
|
||||
log.Error().Err(errors.ErrBadConfig).Msgf("unsupported cache driver: %s", subPath.CacheDriver["name"])
|
||||
log.Error().Err(errors.ErrBadConfig).Interface("cacheDriver", cfg.Storage.CacheDriver["name"]).
|
||||
Msg("unsupported cache driver")
|
||||
|
||||
return errors.ErrBadConfig
|
||||
}
|
||||
}
|
||||
|
||||
if !subPath.RemoteCache && subPath.CacheDriver != nil {
|
||||
log.Warn().Err(errors.ErrBadConfig).Msgf(
|
||||
"remoteCache set to false but cacheDriver config (remote caching) provided for %s,"+
|
||||
"will ignore and use local caching", subPath.RootDirectory)
|
||||
log.Warn().Err(errors.ErrBadConfig).Str("directory", cfg.Storage.RootDirectory).
|
||||
Msg("remoteCache set to false but cacheDriver config (remote caching) provided for directory," +
|
||||
"will ignore and use local caching")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -373,7 +375,8 @@ func validateConfiguration(config *config.Config) error {
|
|||
if len(config.Storage.StorageDriver) != 0 {
|
||||
// enforce s3 driver in case of using storage driver
|
||||
if config.Storage.StorageDriver["name"] != storage.S3StorageDriverName {
|
||||
log.Error().Err(errors.ErrBadConfig).Msgf("unsupported storage driver: %s", config.Storage.StorageDriver["name"])
|
||||
log.Error().Err(errors.ErrBadConfig).Interface("cacheDriver", config.Storage.StorageDriver["name"]).
|
||||
Msg("unsupported storage driver")
|
||||
|
||||
return errors.ErrBadConfig
|
||||
}
|
||||
|
@ -394,8 +397,8 @@ func validateConfiguration(config *config.Config) error {
|
|||
for route, storageConfig := range subPaths {
|
||||
if len(storageConfig.StorageDriver) != 0 {
|
||||
if storageConfig.StorageDriver["name"] != storage.S3StorageDriverName {
|
||||
log.Error().Err(errors.ErrBadConfig).Str("subpath",
|
||||
route).Msgf("unsupported storage driver: %s", storageConfig.StorageDriver["name"])
|
||||
log.Error().Err(errors.ErrBadConfig).Str("subpath", route).Interface("storageDriver",
|
||||
storageConfig.StorageDriver["name"]).Msg("unsupported storage driver")
|
||||
|
||||
return errors.ErrBadConfig
|
||||
}
|
||||
|
@ -577,9 +580,8 @@ func updateDistSpecVersion(config *config.Config) {
|
|||
return
|
||||
}
|
||||
|
||||
log.Warn().
|
||||
Msgf("config dist-spec version: %s differs from version actually used: %s",
|
||||
config.DistSpecVersion, distspec.Version)
|
||||
log.Warn().Str("config version", config.DistSpecVersion).Str("supported version", distspec.Version).
|
||||
Msg("config dist-spec version differs from version actually used")
|
||||
|
||||
config.DistSpecVersion = distspec.Version
|
||||
}
|
||||
|
@ -605,13 +607,13 @@ func LoadConfiguration(config *config.Config, configPath string) error {
|
|||
}
|
||||
|
||||
if len(metaData.Keys) == 0 {
|
||||
log.Error().Err(errors.ErrBadConfig).Msgf("config doesn't contain any key:value pair")
|
||||
log.Error().Err(errors.ErrBadConfig).Msg("config doesn't contain any key:value pair")
|
||||
|
||||
return errors.ErrBadConfig
|
||||
}
|
||||
|
||||
if len(metaData.Unused) > 0 {
|
||||
log.Error().Err(errors.ErrBadConfig).Msgf("unknown keys: %v", metaData.Unused)
|
||||
log.Error().Err(errors.ErrBadConfig).Strs("keys", metaData.Unused).Msg("unknown keys")
|
||||
|
||||
return errors.ErrBadConfig
|
||||
}
|
||||
|
@ -707,8 +709,6 @@ func validateHTTP(config *config.Config) error {
|
|||
|
||||
return errors.ErrBadConfig
|
||||
}
|
||||
|
||||
log.Info().Msgf("HTTP port %d\n", port)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -717,15 +717,15 @@ func validateHTTP(config *config.Config) error {
|
|||
func validateGC(config *config.Config) error {
|
||||
// enforce GC params
|
||||
if config.Storage.GCDelay < 0 {
|
||||
log.Error().Err(errors.ErrBadConfig).
|
||||
Msgf("invalid garbage-collect delay %v specified", config.Storage.GCDelay)
|
||||
log.Error().Err(errors.ErrBadConfig).Dur("delay", config.Storage.GCDelay).
|
||||
Msg("invalid garbage-collect delay specified")
|
||||
|
||||
return errors.ErrBadConfig
|
||||
}
|
||||
|
||||
if config.Storage.GCInterval < 0 {
|
||||
log.Error().Err(errors.ErrBadConfig).
|
||||
Msgf("invalid garbage-collect interval %v specified", config.Storage.GCInterval)
|
||||
log.Error().Err(errors.ErrBadConfig).Dur("interval", config.Storage.GCInterval).
|
||||
Msg("invalid garbage-collect interval specified")
|
||||
|
||||
return errors.ErrBadConfig
|
||||
}
|
||||
|
@ -763,8 +763,8 @@ func validateSync(config *config.Config) error {
|
|||
for id, regCfg := range config.Extensions.Sync.Registries {
|
||||
// check retry options are configured for sync
|
||||
if regCfg.MaxRetries != nil && regCfg.RetryDelay == nil {
|
||||
log.Error().Err(errors.ErrBadConfig).Msgf("extensions.sync.registries[%d].retryDelay"+
|
||||
" is required when using extensions.sync.registries[%d].maxRetries", id, id)
|
||||
log.Error().Err(errors.ErrBadConfig).Int("id", id).Interface("extensions.sync.registries[id]",
|
||||
config.Extensions.Sync.Registries[id]).Msg("retryDelay is required when using maxRetries")
|
||||
|
||||
return errors.ErrBadConfig
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ func MakeHTTPGetRequest(httpClient *http.Client, username string, password strin
|
|||
resp, err := httpClient.Do(req)
|
||||
if err != nil {
|
||||
log.Error().Str("errorType", TypeOf(err)).
|
||||
Err(err).Msgf("couldn't get blob: %s", blobURL)
|
||||
Err(err).Str("blobURL", blobURL).Msg("couldn't get blob")
|
||||
|
||||
return nil, -1, err
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ func MakeHTTPGetRequest(httpClient *http.Client, username string, password strin
|
|||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
log.Error().Str("errorType", TypeOf(err)).
|
||||
Err(err).Msgf("couldn't get blob: %s", blobURL)
|
||||
Err(err).Str("blobURL", blobURL).Msg("couldn't get blob")
|
||||
|
||||
return nil, resp.StatusCode, err
|
||||
}
|
||||
|
@ -198,7 +198,8 @@ func MakeHTTPGetRequest(httpClient *http.Client, username string, password strin
|
|||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
log.Error().Str("status code", fmt.Sprint(resp.StatusCode)).Err(err).Msgf("couldn't get blob: %s", blobURL)
|
||||
log.Error().Str("status code", fmt.Sprint(resp.StatusCode)).
|
||||
Err(err).Str("blobURL", blobURL).Msg("couldn't get blob")
|
||||
|
||||
return nil, resp.StatusCode, errors.New(string(body)) //nolint:goerr113
|
||||
}
|
||||
|
@ -208,7 +209,7 @@ func MakeHTTPGetRequest(httpClient *http.Client, username string, password strin
|
|||
err = json.Unmarshal(body, &resultPtr)
|
||||
if err != nil {
|
||||
log.Error().Str("errorType", TypeOf(err)).
|
||||
Err(err).Msgf("couldn't unmarshal blob: %s", blobURL)
|
||||
Err(err).Str("blobURL", blobURL).Msg("couldn't unmarshal blob")
|
||||
|
||||
return body, resp.StatusCode, err
|
||||
}
|
||||
|
|
|
@ -184,11 +184,12 @@ func runExporter(c *Controller) {
|
|||
}
|
||||
|
||||
http.Handle(c.Config.Exporter.Metrics.Path, promhttp.Handler())
|
||||
c.Log.Info().Msgf("Exporter is listening on %s & exposes metrics on %s path",
|
||||
exporterAddr, c.Config.Exporter.Metrics.Path)
|
||||
c.Log.Info().Str("exporter addr", exporterAddr).
|
||||
Str("exporter metrics path", c.Config.Exporter.Metrics.Path).
|
||||
Msg("Exporter is listening on exporter addr & exposes metrics on exporter metrics path")
|
||||
|
||||
serverAddr := fmt.Sprintf("%s://%s:%s", c.Config.Server.Protocol,
|
||||
c.Config.Server.Host, c.Config.Server.Port)
|
||||
c.Log.Info().Msgf("Scraping metrics from %s", serverAddr)
|
||||
c.Log.Info().Str("serverAddr", serverAddr).Msg("Scraping metrics")
|
||||
c.Log.Fatal().Err(server.ListenAndServe()).Msg("Exporter stopped")
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ func EnableSyncExtension(ctx context.Context, config *config.Config,
|
|||
func SyncOneImage(ctx context.Context, config *config.Config, repoDB repodb.RepoDB,
|
||||
storeController storage.StoreController, repoName, reference string, artifactType string, log log.Logger,
|
||||
) error {
|
||||
log.Info().Msgf("syncing image %s:%s", repoName, reference)
|
||||
log.Info().Str("repository", repoName).Str("reference", reference).Msg("syncing image")
|
||||
|
||||
err := sync.OneImage(ctx, *config.Extensions.Sync, repoDB, storeController, repoName, reference, artifactType, log)
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ func (ms *metricServer) Run() {
|
|||
case bool:
|
||||
ms.reqChan <- ms.enabled
|
||||
default:
|
||||
ms.log.Error().Msgf("unexpected type %T", v)
|
||||
ms.log.Error().Str("type", fmt.Sprintf("%T", v)).Msg("unexpected type")
|
||||
}
|
||||
case <-sendAfter:
|
||||
// Check if we didn't receive a metrics scrape in a while and if so,
|
||||
|
|
|
@ -599,7 +599,8 @@ func RepoMeta2ExpandedRepoInfo(ctx context.Context, repoMeta repodb.RepoMetadata
|
|||
imageSummary, imageBlobs, err := Descriptor2ImageSummary(ctx, descriptor, repoName, tag,
|
||||
skip.Vulnerabilities, repoMeta, manifestMetaMap, indexDataMap, cveInfo)
|
||||
if err != nil {
|
||||
log.Error().Msgf("repodb: erorr while converting descriptor for image '%s:%s'", repoName, tag)
|
||||
log.Error().Str("repository", repoName).Str("reference", tag).
|
||||
Msg("repodb: erorr while converting descriptor for image")
|
||||
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ func (cveinfo BaseCveInfo) GetImageListForCVE(repo, cveID string) ([]cvemodel.Ta
|
|||
|
||||
repoMeta, err := cveinfo.RepoDB.GetRepoMeta(repo)
|
||||
if err != nil {
|
||||
cveinfo.Log.Error().Err(err).Str("repo", repo).Str("cve-id", cveID).
|
||||
cveinfo.Log.Error().Err(err).Str("repository", repo).Str("cve-id", cveID).
|
||||
Msg("unable to get list of tags from repo")
|
||||
|
||||
return imgList, err
|
||||
|
@ -99,7 +99,7 @@ func (cveinfo BaseCveInfo) GetImageListForCVE(repo, cveID string) ([]cvemodel.Ta
|
|||
})
|
||||
}
|
||||
default:
|
||||
cveinfo.Log.Error().Msgf("type '%s' not supported for scanning", descriptor.MediaType)
|
||||
cveinfo.Log.Error().Str("mediaType", descriptor.MediaType).Msg("media type not supported for scanning")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ func (cveinfo BaseCveInfo) GetImageListForCVE(repo, cveID string) ([]cvemodel.Ta
|
|||
func (cveinfo BaseCveInfo) GetImageListWithCVEFixed(repo, cveID string) ([]cvemodel.TagInfo, error) {
|
||||
repoMeta, err := cveinfo.RepoDB.GetRepoMeta(repo)
|
||||
if err != nil {
|
||||
cveinfo.Log.Error().Err(err).Str("repo", repo).Str("cve-id", cveID).
|
||||
cveinfo.Log.Error().Err(err).Str("repository", repo).Str("cve-id", cveID).
|
||||
Msg("unable to get list of tags from repo")
|
||||
|
||||
return []cvemodel.TagInfo{}, err
|
||||
|
@ -127,7 +127,7 @@ func (cveinfo BaseCveInfo) GetImageListWithCVEFixed(repo, cveID string) ([]cvemo
|
|||
case ispec.MediaTypeImageManifest:
|
||||
manifestDigest, err := godigest.Parse(manifestDigestStr)
|
||||
if err != nil {
|
||||
cveinfo.Log.Error().Err(err).Str("repo", repo).Str("tag", tag).
|
||||
cveinfo.Log.Error().Err(err).Str("repository", repo).Str("tag", tag).
|
||||
Str("cve-id", cveID).Str("digest", manifestDigestStr).Msg("unable to parse digest")
|
||||
|
||||
continue
|
||||
|
@ -135,7 +135,7 @@ func (cveinfo BaseCveInfo) GetImageListWithCVEFixed(repo, cveID string) ([]cvemo
|
|||
|
||||
manifestMeta, err := cveinfo.RepoDB.GetManifestMeta(repo, manifestDigest)
|
||||
if err != nil {
|
||||
cveinfo.Log.Error().Err(err).Str("repo", repo).Str("tag", tag).
|
||||
cveinfo.Log.Error().Err(err).Str("repository", repo).Str("tag", tag).
|
||||
Str("cve-id", cveID).Msg("unable to obtain manifest meta")
|
||||
|
||||
continue
|
||||
|
@ -145,7 +145,7 @@ func (cveinfo BaseCveInfo) GetImageListWithCVEFixed(repo, cveID string) ([]cvemo
|
|||
|
||||
err = json.Unmarshal(manifestMeta.ConfigBlob, &configContent)
|
||||
if err != nil {
|
||||
cveinfo.Log.Error().Err(err).Str("repo", repo).Str("tag", tag).
|
||||
cveinfo.Log.Error().Err(err).Str("repository", repo).Str("tag", tag).
|
||||
Str("cve-id", cveID).Msg("unable to unmashal manifest blob")
|
||||
|
||||
continue
|
||||
|
@ -195,7 +195,7 @@ func (cveinfo BaseCveInfo) GetImageListWithCVEFixed(repo, cveID string) ([]cvemo
|
|||
vulnerableTags = append(vulnerableTags, tagInfo)
|
||||
}
|
||||
default:
|
||||
cveinfo.Log.Error().Msgf("media type not supported '%s'", descriptor.MediaType)
|
||||
cveinfo.Log.Error().Str("mediaType", descriptor.MediaType).Msg("media type not supported")
|
||||
|
||||
return []cvemodel.TagInfo{},
|
||||
fmt.Errorf("media type '%s' is not supported: %w", descriptor.MediaType, errors.ErrNotImplemented)
|
||||
|
@ -205,11 +205,13 @@ func (cveinfo BaseCveInfo) GetImageListWithCVEFixed(repo, cveID string) ([]cvemo
|
|||
var fixedTags []cvemodel.TagInfo
|
||||
|
||||
if len(vulnerableTags) != 0 {
|
||||
cveinfo.Log.Info().Str("repo", repo).Str("cve-id", cveID).Msgf("Vulnerable tags: %v", vulnerableTags)
|
||||
cveinfo.Log.Info().Str("repository", repo).Str("cve-id", cveID).
|
||||
Interface("vulnerableTags", vulnerableTags).Msg("Vulnerable tags")
|
||||
fixedTags = GetFixedTags(allTags, vulnerableTags)
|
||||
cveinfo.Log.Info().Str("repo", repo).Str("cve-id", cveID).Msgf("Fixed tags: %v", fixedTags)
|
||||
cveinfo.Log.Info().Str("repository", repo).Str("cve-id", cveID).
|
||||
Interface("fixedTags", fixedTags).Msg("Fixed tags")
|
||||
} else {
|
||||
cveinfo.Log.Info().Str("repo", repo).Str("cve-id", cveID).
|
||||
cveinfo.Log.Info().Str("repository", repo).Str("cve-id", cveID).
|
||||
Msg("image does not contain any tag that have given cve")
|
||||
fixedTags = allTags
|
||||
}
|
||||
|
|
|
@ -240,8 +240,8 @@ func (scanner Scanner) isManifestScanable(descriptor repodb.Descriptor) (bool, e
|
|||
case ispec.MediaTypeImageLayerGzip, ispec.MediaTypeImageLayer, string(regTypes.DockerLayer):
|
||||
continue
|
||||
default:
|
||||
scanner.log.Debug().
|
||||
Msgf("image media type %s not supported for scanning", imageLayer.MediaType)
|
||||
scanner.log.Debug().Str("mediaType", imageLayer.MediaType).
|
||||
Msg("image media type not supported for scanning")
|
||||
|
||||
return false, zerr.ErrScanNotSupported
|
||||
}
|
||||
|
@ -367,19 +367,19 @@ func (scanner Scanner) UpdateDB() error {
|
|||
}
|
||||
|
||||
func (scanner Scanner) updateDB(dbDir string) error {
|
||||
scanner.log.Debug().Msgf("Download Trivy DB to destination dir: %s", dbDir)
|
||||
scanner.log.Debug().Str("dbDir", dbDir).Msg("Download Trivy DB to destination dir")
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
err := operation.DownloadDB(ctx, "dev", dbDir, scanner.dbRepository, false, false,
|
||||
fanalTypes.RemoteOptions{Insecure: false})
|
||||
if err != nil {
|
||||
scanner.log.Error().Err(err).Msgf("Error downloading Trivy DB to destination dir: %s", dbDir)
|
||||
scanner.log.Error().Err(err).Str("dbDir", dbDir).Msg("Error downloading Trivy DB to destination dir")
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
scanner.log.Debug().Msgf("Finished downloading Trivy DB to destination dir: %s", dbDir)
|
||||
scanner.log.Debug().Str("dbDir", dbDir).Msg("Finished downloading Trivy DB to destination dir")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ func getImageSummary(ctx context.Context, repo, tag string, digest *string, repo
|
|||
|
||||
indexDataMap[indexDigest] = indexData
|
||||
default:
|
||||
log.Error().Msgf("resolver: media type '%s' not supported", manifestDescriptor.MediaType)
|
||||
log.Error().Str("mediaType", manifestDescriptor.MediaType).Msg("resolver: media type not supported")
|
||||
}
|
||||
|
||||
skip := convert.SkipQGLField{
|
||||
|
@ -399,11 +399,11 @@ func getImageListForCVE(
|
|||
for _, repoMeta := range reposMeta {
|
||||
repo := repoMeta.Name
|
||||
|
||||
log.Info().Str("repo", repo).Str("CVE", cveID).Msg("extracting list of tags affected by CVE")
|
||||
log.Info().Str("repository", repo).Str("CVE", cveID).Msg("extracting list of tags affected by CVE")
|
||||
|
||||
tagsInfo, err := cveInfo.GetImageListForCVE(repo, cveID)
|
||||
if err != nil {
|
||||
log.Error().Str("repo", repo).Str("CVE", cveID).Err(err).
|
||||
log.Error().Str("repository", repo).Str("CVE", cveID).Err(err).
|
||||
Msg("error getting image list for CVE from repo")
|
||||
|
||||
return &gql_generated.PaginatedImagesResult{}, err
|
||||
|
@ -463,11 +463,11 @@ func getImageListWithCVEFixed(
|
|||
) (*gql_generated.PaginatedImagesResult, error) {
|
||||
imageList := make([]*gql_generated.ImageSummary, 0)
|
||||
|
||||
log.Info().Str("repo", repo).Str("CVE", cveID).Msg("extracting list of tags where CVE is fixed")
|
||||
log.Info().Str("repository", repo).Str("CVE", cveID).Msg("extracting list of tags where CVE is fixed")
|
||||
|
||||
tagsInfo, err := cveInfo.GetImageListWithCVEFixed(repo, cveID)
|
||||
if err != nil {
|
||||
log.Error().Str("repo", repo).Str("CVE", cveID).Err(err).
|
||||
log.Error().Str("repository", repo).Str("CVE", cveID).Err(err).
|
||||
Msg("error getting image list with CVE fixed from repo")
|
||||
|
||||
return &gql_generated.PaginatedImagesResult{
|
||||
|
@ -1091,14 +1091,14 @@ func deleteElementAt(slice []*string, i int) []*string {
|
|||
func expandedRepoInfo(ctx context.Context, repo string, repoDB repodb.RepoDB, cveInfo cveinfo.CveInfo, log log.Logger,
|
||||
) (*gql_generated.RepoInfo, error) {
|
||||
if ok, err := localCtx.RepoIsUserAvailable(ctx, repo); !ok || err != nil {
|
||||
log.Info().Err(err).Msgf("resolver: 'repo %s is user available' = %v", repo, ok)
|
||||
log.Info().Err(err).Str("repository", repo).Bool("availability", ok).Msg("resolver: repo user availability")
|
||||
|
||||
return &gql_generated.RepoInfo{}, nil //nolint:nilerr // don't give details to a potential attacker
|
||||
}
|
||||
|
||||
repoMeta, err := repoDB.GetRepoMeta(repo)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("resolver: can't retrieve repoMeta for repo %s", repo)
|
||||
log.Error().Err(err).Str("repository", repo).Msg("resolver: can't retrieve repoMeta for repo")
|
||||
|
||||
return &gql_generated.RepoInfo{}, err
|
||||
}
|
||||
|
@ -1276,7 +1276,7 @@ func getReferrers(repoDB repodb.RepoDB, repo string, referredDigest string, arti
|
|||
) ([]*gql_generated.Referrer, error) {
|
||||
refDigest := godigest.Digest(referredDigest)
|
||||
if err := refDigest.Validate(); err != nil {
|
||||
log.Error().Err(err).Msgf("graphql: bad digest string from request '%s'", referredDigest)
|
||||
log.Error().Err(err).Str("digest", referredDigest).Msg("graphql: bad referenced digest string from request")
|
||||
|
||||
return []*gql_generated.Referrer{}, fmt.Errorf("graphql: bad digest string from request '%s' %w",
|
||||
referredDigest, err)
|
||||
|
|
|
@ -73,7 +73,7 @@ func (r *queryResolver) ImageList(ctx context.Context, repo string, requestedPag
|
|||
|
||||
imageList, err := getImageList(ctx, repo, r.repoDB, r.cveInfo, requestedPage, r.log)
|
||||
if err != nil {
|
||||
r.log.Error().Err(err).Msgf("unable to retrieve image list for repo: %s", repo)
|
||||
r.log.Error().Err(err).Str("repository", repo).Msg("unable to retrieve image list for repo")
|
||||
|
||||
return imageList, err
|
||||
}
|
||||
|
|
|
@ -69,7 +69,8 @@ func OneImage(ctx context.Context, cfg syncconf.Config, repoDB repodb.RepoDB,
|
|||
imageChannel, found := demandedImgs.loadOrStoreChan(demandedImage, make(chan error))
|
||||
// if value found wait on channel receive or close
|
||||
if found {
|
||||
log.Info().Msgf("image %s already demanded by another client, waiting on imageChannel", demandedImage)
|
||||
log.Info().Str("demandedImage", demandedImage).
|
||||
Msg("image already demanded by another client, waiting on imageChannel")
|
||||
|
||||
err, ok := <-imageChannel
|
||||
// if channel closed exit
|
||||
|
@ -105,7 +106,7 @@ func syncOneImage(ctx context.Context, imageChannel chan error, cfg syncconf.Con
|
|||
credentialsFile, err = getFileCredentials(cfg.CredentialsFile)
|
||||
if err != nil {
|
||||
log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't get registry credentials from %s", cfg.CredentialsFile)
|
||||
Err(err).Str("credentialsFile", cfg.CredentialsFile).Msg("couldn't get registry credentials from file")
|
||||
|
||||
imageChannel <- err
|
||||
|
||||
|
@ -123,7 +124,8 @@ func syncOneImage(ctx context.Context, imageChannel chan error, cfg syncconf.Con
|
|||
for _, registryCfg := range cfg.Registries {
|
||||
regCfg := registryCfg
|
||||
if !regCfg.OnDemand {
|
||||
log.Info().Msgf("skipping syncing on demand from %v, onDemand flag is false", regCfg.URLs)
|
||||
log.Info().Strs("registry", regCfg.URLs).
|
||||
Msg("skipping syncing on demand from registry, onDemand flag is false")
|
||||
|
||||
continue
|
||||
}
|
||||
|
@ -134,8 +136,8 @@ func syncOneImage(ctx context.Context, imageChannel chan error, cfg syncconf.Con
|
|||
if len(regCfg.Content) != 0 {
|
||||
contentID, err := findRepoMatchingContentID(localRepo, regCfg.Content)
|
||||
if err != nil {
|
||||
log.Info().Msgf("skipping syncing on demand %s from %v registry because it's filtered out by content config",
|
||||
localRepo, regCfg.URLs)
|
||||
log.Info().Str("localRepo", localRepo).Strs("registry",
|
||||
regCfg.URLs).Msg("skipping syncing on demand repo from registry because it's filtered out by content config")
|
||||
|
||||
continue
|
||||
}
|
||||
|
@ -152,7 +154,7 @@ func syncOneImage(ctx context.Context, imageChannel chan error, cfg syncconf.Con
|
|||
}
|
||||
}
|
||||
|
||||
log.Info().Msgf("syncing on demand with %v", regCfg.URLs)
|
||||
log.Info().Strs("registry", regCfg.URLs).Msg("syncing on demand with registry")
|
||||
|
||||
for _, regCfgURL := range regCfg.URLs {
|
||||
upstreamURL := regCfgURL
|
||||
|
@ -233,7 +235,7 @@ func syncOneImage(ctx context.Context, imageChannel chan error, cfg syncconf.Con
|
|||
|
||||
_, found := demandedImgs.loadOrStoreStr(demandedImageRef, "")
|
||||
if found {
|
||||
log.Info().Msgf("image %s already demanded in background", demandedImageRef)
|
||||
log.Info().Str("demandedImageRef", demandedImageRef).Msg("image already demanded in background")
|
||||
/* we already have a go routine spawned for this image
|
||||
or retryOptions is not configured */
|
||||
continue
|
||||
|
@ -244,11 +246,11 @@ func syncOneImage(ctx context.Context, imageChannel chan error, cfg syncconf.Con
|
|||
// remove image after syncing
|
||||
defer func() {
|
||||
demandedImgs.delete(demandedImageRef)
|
||||
log.Info().Msgf("sync routine: %s exited", demandedImageRef)
|
||||
log.Info().Str("demandedImageRef", demandedImageRef).Msg("sync routine: demanded image exited")
|
||||
}()
|
||||
|
||||
log.Info().Msgf("sync routine: starting routine to copy image %s, cause err: %v",
|
||||
demandedImageRef, copyErr)
|
||||
log.Info().Str("demandedImageRef", demandedImageRef).Str("copyErr", copyErr.Error()).
|
||||
Msg("sync routine: starting routine to copy image, err encountered")
|
||||
time.Sleep(retryOptions.Delay)
|
||||
|
||||
if err = retry.RetryIfNecessary(ctx, func() error {
|
||||
|
@ -256,8 +258,8 @@ func syncOneImage(ctx context.Context, imageChannel chan error, cfg syncconf.Con
|
|||
|
||||
return err
|
||||
}, retryOptions); err != nil {
|
||||
log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("sync routine: error while copying image %s", demandedImageRef)
|
||||
log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("demandedImageRef", demandedImageRef).Msg("sync routine: error while copying image")
|
||||
}
|
||||
}()
|
||||
} else {
|
||||
|
@ -276,9 +278,9 @@ func syncRun(localRepo, upstreamRepo, reference string, utils syncContextUtils,
|
|||
) (bool, error) {
|
||||
upstreamImageRef, err := getImageRef(utils.upstreamAddr, upstreamRepo, reference)
|
||||
if err != nil {
|
||||
log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("error creating docker reference for repository %s/%s:%s",
|
||||
utils.upstreamAddr, upstreamRepo, reference)
|
||||
log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("repository", utils.upstreamAddr+"/"+upstreamRepo+":"+reference).
|
||||
Msg("error creating docker reference for repository")
|
||||
|
||||
return false, err
|
||||
}
|
||||
|
@ -287,7 +289,7 @@ func syncRun(localRepo, upstreamRepo, reference string, utils syncContextUtils,
|
|||
|
||||
localCachePath, err := getLocalCachePath(imageStore, localRepo)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("couldn't get localCachePath for %s", localRepo)
|
||||
log.Error().Err(err).Str("repository", localRepo).Msg("couldn't get localCachePath for repository")
|
||||
|
||||
return false, err
|
||||
}
|
||||
|
@ -306,16 +308,16 @@ func syncSignaturesArtifacts(sig *signaturesCopier, localRepo, upstreamRepo, ref
|
|||
// is cosign signature
|
||||
cosignManifest, err := sig.getCosignManifest(upstreamRepo, reference)
|
||||
if err != nil {
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't get upstream image %s:%s:%s cosign manifest", upstreamURL, upstreamRepo, reference)
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("image", upstreamURL+"/"+upstreamRepo+":"+reference).Msg("couldn't get upstream image cosign manifest")
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
err = sig.syncCosignSignature(localRepo, upstreamRepo, reference, cosignManifest)
|
||||
if err != nil {
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't copy upstream image cosign signature %s/%s:%s", upstreamURL, upstreamRepo, reference)
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("image", upstreamURL+"/"+upstreamRepo+":"+reference).Msg("couldn't copy upstream image cosign signature")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -323,16 +325,16 @@ func syncSignaturesArtifacts(sig *signaturesCopier, localRepo, upstreamRepo, ref
|
|||
// is oras artifact
|
||||
refs, err := sig.getORASRefs(upstreamRepo, reference)
|
||||
if err != nil {
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't get upstream image %s/%s:%s ORAS references", upstreamURL, upstreamRepo, reference)
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("image", upstreamURL+"/"+upstreamRepo+":"+reference).Msg("couldn't get upstream image ORAS references")
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
err = sig.syncORASRefs(localRepo, upstreamRepo, reference, refs)
|
||||
if err != nil {
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't copy image ORAS references %s/%s:%s", upstreamURL, upstreamRepo, reference)
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("image", upstreamURL+"/"+upstreamRepo+":"+reference).Msg("couldn't copy image ORAS references")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -340,16 +342,16 @@ func syncSignaturesArtifacts(sig *signaturesCopier, localRepo, upstreamRepo, ref
|
|||
// this contains notary signatures
|
||||
index, err := sig.getOCIRefs(upstreamRepo, reference)
|
||||
if err != nil {
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't get OCI references %s/%s:%s", upstreamURL, upstreamRepo, reference)
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("image", upstreamURL+"/"+upstreamRepo+":"+reference).Msg("couldn't get OCI references")
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
err = sig.syncOCIRefs(localRepo, upstreamRepo, reference, index)
|
||||
if err != nil {
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't copy OCI references %s/%s:%s", upstreamURL, upstreamRepo, reference)
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("image", upstreamURL+"/"+upstreamRepo+":"+reference).Msg("couldn't copy OCI references")
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -64,14 +64,14 @@ func (sig *signaturesCopier) getCosignManifest(repo, digestStr string) (*ispec.M
|
|||
getCosignManifestURL.String(), ispec.MediaTypeImageManifest, sig.log)
|
||||
if err != nil {
|
||||
if statusCode == http.StatusNotFound {
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't find any cosign manifest: %s", getCosignManifestURL.String())
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("manifest", getCosignManifestURL.String()).Msg("couldn't find any cosign manifest")
|
||||
|
||||
return nil, zerr.ErrSyncReferrerNotFound
|
||||
}
|
||||
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't get cosign manifest: %s", getCosignManifestURL.String())
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("manifest", getCosignManifestURL.String()).Msg("couldn't get cosign manifest")
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
@ -122,15 +122,15 @@ func (sig *signaturesCopier) getOCIRefs(repo, digestStr string) (ispec.Index, er
|
|||
getReferrersURL.String(), "application/json", sig.log)
|
||||
if err != nil {
|
||||
if statusCode == http.StatusNotFound {
|
||||
sig.log.Info().Msgf("couldn't find any oci reference from %s, status code: %d, skipping",
|
||||
getReferrersURL.String(), statusCode)
|
||||
sig.log.Info().Str("referrers", getReferrersURL.String()).Int("statusCode", statusCode).
|
||||
Msg("couldn't find any oci reference from referrers, skipping")
|
||||
|
||||
return index, zerr.ErrSyncReferrerNotFound
|
||||
}
|
||||
|
||||
sig.log.Error().Str("errorType", common.TypeOf(zerr.ErrSyncReferrer)).
|
||||
Err(zerr.ErrSyncReferrer).Msgf("couldn't get oci reference from %s, status code: %d skipping",
|
||||
getReferrersURL.String(), statusCode)
|
||||
sig.log.Error().Str("errorType", common.TypeOf(zerr.ErrSyncReferrer)).Err(zerr.ErrSyncReferrer).
|
||||
Str("referrers", getReferrersURL.String()).Int("statusCode", statusCode).
|
||||
Msg("couldn't get oci reference from referrers, skipping")
|
||||
|
||||
return index, zerr.ErrSyncReferrer
|
||||
}
|
||||
|
@ -150,8 +150,8 @@ func (sig *signaturesCopier) syncCosignSignature(localRepo, remoteRepo, digestSt
|
|||
|
||||
skipCosignSig, err := sig.canSkipCosignSignature(localRepo, digestStr, cosignManifest)
|
||||
if err != nil {
|
||||
sig.log.Error().Err(err).Msgf("couldn't check if the upstream image %s:%s cosign signature can be skipped",
|
||||
remoteRepo, digestStr)
|
||||
sig.log.Error().Err(err).Str("repository", remoteRepo).Str("reference", digestStr).
|
||||
Msg("couldn't check if the upstream image cosign signature can be skipped")
|
||||
}
|
||||
|
||||
if skipCosignSig {
|
||||
|
@ -190,7 +190,8 @@ func (sig *signaturesCopier) syncCosignSignature(localRepo, remoteRepo, digestSt
|
|||
}
|
||||
|
||||
if sig.repoDB != nil {
|
||||
sig.log.Debug().Msgf("trying to sync cosign signature for repo %s digest %s", localRepo, digestStr)
|
||||
sig.log.Debug().Str("repository", localRepo).Str("digest", digestStr).
|
||||
Msg("trying to sync cosign signature for repo digest")
|
||||
|
||||
err = repodb.SetMetadataFromInput(localRepo, cosignTag, ispec.MediaTypeImageManifest,
|
||||
godigest.FromBytes(cosignManifestBuf), cosignManifestBuf, sig.storeController.GetImageStore(localRepo),
|
||||
|
@ -199,7 +200,8 @@ func (sig *signaturesCopier) syncCosignSignature(localRepo, remoteRepo, digestSt
|
|||
return fmt.Errorf("failed to set metadata for cosign signature '%s@%s': %w", localRepo, digestStr, err)
|
||||
}
|
||||
|
||||
sig.log.Info().Msgf("successfully added cosign signature to RepoDB for repo %s digest %s", localRepo, digestStr)
|
||||
sig.log.Info().Str("repository", localRepo).Str("digest", digestStr).
|
||||
Msg("successfully added cosign signature to RepoDB for repo digest")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -213,8 +215,8 @@ func (sig *signaturesCopier) syncORASRefs(localRepo, remoteRepo, digestStr strin
|
|||
|
||||
skipORASRefs, err := sig.canSkipORASRefs(localRepo, digestStr, referrers)
|
||||
if err != nil {
|
||||
sig.log.Error().Err(err).Msgf("couldn't check if the upstream image %s:%s ORAS artifact can be skipped",
|
||||
remoteRepo, digestStr)
|
||||
sig.log.Error().Err(err).Str("repository", remoteRepo).Str("reference", digestStr).
|
||||
Msg("couldn't check if the upstream image ORAS artifact can be skipped")
|
||||
}
|
||||
|
||||
if skipORASRefs {
|
||||
|
@ -238,14 +240,14 @@ func (sig *signaturesCopier) syncORASRefs(localRepo, remoteRepo, digestStr strin
|
|||
getRefManifestURL.String(), ref.MediaType, sig.log)
|
||||
if err != nil {
|
||||
if statusCode == http.StatusNotFound {
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't find any ORAS manifest: %s", getRefManifestURL.String())
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("manifest", getRefManifestURL.String()).Msg("couldn't find any ORAS manifest")
|
||||
|
||||
return zerr.ErrSyncReferrerNotFound
|
||||
}
|
||||
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't get ORAS manifest: %s", getRefManifestURL.String())
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("manifest", getRefManifestURL.String()).Msg("couldn't get ORAS manifest")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -267,7 +269,8 @@ func (sig *signaturesCopier) syncORASRefs(localRepo, remoteRepo, digestStr strin
|
|||
|
||||
// this is for notation signatures
|
||||
if sig.repoDB != nil {
|
||||
sig.log.Debug().Msgf("trying to sync oras artifact for repo %s digest %s", localRepo, digestStr)
|
||||
sig.log.Debug().Str("repository", localRepo).Str("digest", digestStr).
|
||||
Msg("trying to sync oras artifact for digest")
|
||||
|
||||
err = repodb.SetMetadataFromInput(localRepo, ref.Digest.String(), ref.MediaType,
|
||||
ref.Digest, body, sig.storeController.GetImageStore(localRepo), sig.repoDB, sig.log)
|
||||
|
@ -275,11 +278,13 @@ func (sig *signaturesCopier) syncORASRefs(localRepo, remoteRepo, digestStr strin
|
|||
return fmt.Errorf("failed to set metadata for oras artifact '%s@%s': %w", localRepo, digestStr, err)
|
||||
}
|
||||
|
||||
sig.log.Info().Msgf("successfully added oras artifacts to RepoDB for repo %s digest %s", localRepo, digestStr)
|
||||
sig.log.Info().Str("repository", localRepo).Str("digest", digestStr).
|
||||
Msg("successfully added oras artifacts to RepoDB for digest")
|
||||
}
|
||||
}
|
||||
|
||||
sig.log.Info().Msgf("successfully synced ORAS artifacts for repo %s digest %s", localRepo, digestStr)
|
||||
sig.log.Info().Str("repository", localRepo).Str("digest", digestStr).
|
||||
Msg("successfully synced ORAS artifacts for digest")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -292,8 +297,8 @@ func (sig *signaturesCopier) syncOCIRefs(localRepo, remoteRepo, digestStr string
|
|||
|
||||
skipOCIRefs, err := sig.canSkipOCIRefs(localRepo, digestStr, index)
|
||||
if err != nil {
|
||||
sig.log.Error().Err(err).Msgf("couldn't check if the upstream image %s:%s oci references can be skipped",
|
||||
remoteRepo, digestStr)
|
||||
sig.log.Error().Err(err).Str("repository", remoteRepo).Str("reference", digestStr).
|
||||
Msg("couldn't check if the upstream image oci references can be skipped")
|
||||
}
|
||||
|
||||
if skipOCIRefs {
|
||||
|
@ -316,14 +321,14 @@ func (sig *signaturesCopier) syncOCIRefs(localRepo, remoteRepo, digestStr string
|
|||
getRefManifestURL.String(), ref.MediaType, sig.log)
|
||||
if err != nil {
|
||||
if statusCode == http.StatusNotFound {
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't find any oci reference manifest: %s", getRefManifestURL.String())
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("manifest", getRefManifestURL.String()).Msg("couldn't find any oci reference manifest")
|
||||
|
||||
return zerr.ErrSyncReferrerNotFound
|
||||
}
|
||||
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't get oci reference manifest: %s", getRefManifestURL.String())
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("manifest", getRefManifestURL.String()).Msg("couldn't get oci reference manifest")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -334,8 +339,8 @@ func (sig *signaturesCopier) syncOCIRefs(localRepo, remoteRepo, digestStr string
|
|||
|
||||
err = json.Unmarshal(OCIRefBody, &manifest)
|
||||
if err != nil {
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't unmarshal oci reference manifest: %s", getRefManifestURL.String())
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("manifest", getRefManifestURL.String()).Msg("couldn't unmarshal oci reference manifest")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -356,8 +361,8 @@ func (sig *signaturesCopier) syncOCIRefs(localRepo, remoteRepo, digestStr string
|
|||
|
||||
err = json.Unmarshal(OCIRefBody, &manifest)
|
||||
if err != nil {
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't unmarshal oci reference manifest: %s", getRefManifestURL.String())
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("manifest", getRefManifestURL.String()).Msg("couldn't unmarshal oci reference manifest")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -379,7 +384,7 @@ func (sig *signaturesCopier) syncOCIRefs(localRepo, remoteRepo, digestStr string
|
|||
}
|
||||
|
||||
if sig.repoDB != nil {
|
||||
sig.log.Debug().Msgf("trying to add OCI refs for repo %s digest %s", localRepo, digestStr)
|
||||
sig.log.Debug().Str("repository", localRepo).Str("digest", digestStr).Msg("trying to add OCI refs for repo digest")
|
||||
|
||||
err = repodb.SetMetadataFromInput(localRepo, digestStr, ref.MediaType,
|
||||
digest, OCIRefBody, sig.storeController.GetImageStore(localRepo),
|
||||
|
@ -388,11 +393,13 @@ func (sig *signaturesCopier) syncOCIRefs(localRepo, remoteRepo, digestStr string
|
|||
return fmt.Errorf("failed to set metadata for OCI ref in '%s@%s': %w", localRepo, digestStr, err)
|
||||
}
|
||||
|
||||
sig.log.Info().Msgf("successfully added OCI refs to RepoDB for repo %s digest %s", localRepo, digestStr)
|
||||
sig.log.Info().Str("repository", localRepo).Str("digest", digestStr).
|
||||
Msg("successfully added OCI refs to RepoDB for digest")
|
||||
}
|
||||
}
|
||||
|
||||
sig.log.Info().Msgf("successfully synced OCI refs for repo %s digest %s", localRepo, digestStr)
|
||||
sig.log.Info().Str("repository", localRepo).Str("digest", digestStr).
|
||||
Msg("successfully synced OCI refs for digest")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -404,15 +411,16 @@ func (sig *signaturesCopier) syncOCIArtifact(localRepo, remoteRepo, reference st
|
|||
|
||||
err := json.Unmarshal(ociArtifactBuf, &ociArtifact)
|
||||
if err != nil {
|
||||
sig.log.Error().Err(err).Msgf("couldn't unmarshal OCI artifact from %s:%s", remoteRepo, reference)
|
||||
sig.log.Error().Err(err).Str("repository", remoteRepo).Str("reference", reference).
|
||||
Msg("couldn't unmarshal OCI artifact")
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
canSkipOCIArtifact, err := sig.canSkipOCIArtifact(localRepo, reference, ociArtifact)
|
||||
if err != nil {
|
||||
sig.log.Error().Err(err).Msgf("couldn't check if OCI artifact %s:%s can be skipped",
|
||||
remoteRepo, reference)
|
||||
sig.log.Error().Err(err).Str("repository", remoteRepo).Str("reference", reference).
|
||||
Msg("couldn't check if OCI artifact can be skipped")
|
||||
}
|
||||
|
||||
if canSkipOCIArtifact {
|
||||
|
@ -448,7 +456,8 @@ func (sig *signaturesCopier) syncOCIArtifact(localRepo, remoteRepo, reference st
|
|||
}
|
||||
|
||||
if sig.repoDB != nil {
|
||||
sig.log.Debug().Msgf("trying to OCI refs for repo %s digest %s", localRepo, digest.String())
|
||||
sig.log.Debug().Str("repository", localRepo).Str("digest", digest.String()).
|
||||
Msg("trying to OCI refs for repo digest")
|
||||
|
||||
err = repodb.SetMetadataFromInput(localRepo, reference, ispec.MediaTypeArtifactManifest,
|
||||
digest, artifactManifestBuf, sig.storeController.GetImageStore(localRepo),
|
||||
|
@ -457,11 +466,12 @@ func (sig *signaturesCopier) syncOCIArtifact(localRepo, remoteRepo, reference st
|
|||
return fmt.Errorf("failed to set metadata for OCI Artifact '%s@%s': %w", localRepo, digest.String(), err)
|
||||
}
|
||||
|
||||
sig.log.Info().Msgf("successfully added oci artifacts to RepoDB for repo %s digest %s", localRepo,
|
||||
digest.String())
|
||||
sig.log.Info().Str("repository", localRepo).Str("digest", digest.String()).
|
||||
Msg("successfully added oci artifacts to RepoDB for repo digest")
|
||||
}
|
||||
|
||||
sig.log.Info().Msgf("successfully synced OCI artifact for repo %s tag %s", localRepo, reference)
|
||||
sig.log.Info().Str("repository", localRepo).Str("tag", reference).
|
||||
Msg("successfully synced OCI artifact for repo tag")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -479,20 +489,22 @@ func (sig *signaturesCopier) canSkipORASRefs(localRepo, digestStr string, refs R
|
|||
return false, nil
|
||||
}
|
||||
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't get local ORAS artifact %s:%s manifest", localRepo, digestStr)
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("repository", localRepo).Str("reference", digestStr).Msg("couldn't get local ORAS artifact manifest")
|
||||
|
||||
return false, err
|
||||
}
|
||||
|
||||
if !artifactDescriptorsEqual(localRefs, refs.References) {
|
||||
sig.log.Info().Msgf("upstream ORAS artifacts %s:%s changed, syncing again", localRepo, digestStr)
|
||||
sig.log.Info().Str("repository", localRepo).Str("reference", digestStr).
|
||||
Msg("upstream ORAS artifacts changed, syncing again")
|
||||
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
sig.log.Info().Msgf("skipping ORAS artifact %s:%s, already synced", localRepo, digestStr)
|
||||
sig.log.Info().Str("repository", localRepo).Str("reference", digestStr).
|
||||
Msg("skipping ORAS artifact, already synced")
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
@ -509,27 +521,31 @@ func (sig *signaturesCopier) canSkipOCIArtifact(localRepo, reference string, art
|
|||
return false, nil
|
||||
}
|
||||
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't get local OCI artifact %s:%s manifest", localRepo, reference)
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("repository", localRepo).Str("reference", reference).
|
||||
Msg("couldn't get local OCI artifact manifest")
|
||||
|
||||
return false, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(localArtifactBuf, &localArtifactManifest)
|
||||
if err != nil {
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't unmarshal local OCI artifact %s:%s manifest", localRepo, reference)
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("repository", localRepo).Str("reference", reference).
|
||||
Msg("couldn't unmarshal local OCI artifact manifest")
|
||||
|
||||
return false, err
|
||||
}
|
||||
|
||||
if !artifactsEqual(localArtifactManifest, artifact) {
|
||||
sig.log.Info().Msgf("upstream OCI artifact %s:%s changed, syncing again", localRepo, reference)
|
||||
sig.log.Info().Str("repository", localRepo).Str("reference", reference).
|
||||
Msg("upstream OCI artifact changed, syncing again")
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
sig.log.Info().Msgf("skipping OCI artifact %s:%s, already synced", localRepo, reference)
|
||||
sig.log.Info().Str("repository", localRepo).Str("reference", reference).
|
||||
Msg("skipping OCI artifact, already synced")
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
@ -551,28 +567,32 @@ func (sig *signaturesCopier) canSkipCosignSignature(localRepo, digestStr string,
|
|||
return false, nil
|
||||
}
|
||||
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't get local cosign %s:%s manifest", localRepo, digestStr)
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("repository", localRepo).Str("reference", digestStr).
|
||||
Msg("couldn't get local cosign manifest")
|
||||
|
||||
return false, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(localCosignManifestBuf, &localCosignManifest)
|
||||
if err != nil {
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't unmarshal local cosign signature %s:%s manifest", localRepo, digestStr)
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("repository", localRepo).Str("reference", digestStr).
|
||||
Msg("couldn't unmarshal local cosign signature manifest")
|
||||
|
||||
return false, err
|
||||
}
|
||||
|
||||
if !manifestsEqual(localCosignManifest, *cosignManifest) {
|
||||
sig.log.Info().Msgf("upstream cosign signatures %s:%s changed, syncing again", localRepo, digestStr)
|
||||
sig.log.Info().Str("repository", localRepo).Str("reference", digestStr).
|
||||
Msg("upstream cosign signatures changed, syncing again")
|
||||
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
sig.log.Info().Msgf("skipping cosign signature %s:%s, already synced", localRepo, digestStr)
|
||||
sig.log.Info().Str("repository", localRepo).Str("reference", digestStr).
|
||||
Msg("skipping cosign signature, already synced")
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
@ -590,20 +610,23 @@ func (sig *signaturesCopier) canSkipOCIRefs(localRepo, digestStr string, index i
|
|||
return false, nil
|
||||
}
|
||||
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't get local ocireferences for %s:%s manifest", localRepo, digestStr)
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("repository", localRepo).Str("reference", digestStr).
|
||||
Msg("couldn't get local ocireferences for manifest")
|
||||
|
||||
return false, err
|
||||
}
|
||||
|
||||
if !descriptorsEqual(localRefs.Manifests, index.Manifests) {
|
||||
sig.log.Info().Msgf("upstream oci references for %s:%s changed, syncing again", localRepo, digestStr)
|
||||
sig.log.Info().Str("repository", localRepo).Str("reference", digestStr).
|
||||
Msg("upstream oci references for manifest changed, syncing again")
|
||||
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
sig.log.Info().Msgf("skipping oci references %s:%s, already synced", localRepo, digestStr)
|
||||
sig.log.Info().Str("repository", localRepo).Str("reference", digestStr).
|
||||
Msg("skipping oci references, already synced")
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
@ -622,8 +645,8 @@ func syncBlob(sig *signaturesCopier, imageStore storage.ImageStore, remoteRepo,
|
|||
|
||||
resp, err := sig.client.Do(req)
|
||||
if err != nil {
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Str("url", getBlobURL.String()).
|
||||
Err(err).Msgf("couldn't get blob: %s", getBlobURL.String())
|
||||
sig.log.Error().Str("errorType", common.TypeOf(err)).Str("blob url", getBlobURL.String()).
|
||||
Err(err).Msg("couldn't get blob from url")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -631,8 +654,8 @@ func syncBlob(sig *signaturesCopier, imageStore storage.ImageStore, remoteRepo,
|
|||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
sig.log.Info().Str("url", getBlobURL.String()).Msgf("couldn't find blob from %s, status code: %d",
|
||||
getBlobURL.String(), resp.StatusCode)
|
||||
sig.log.Info().Str("url", getBlobURL.String()).Str("blob url", getBlobURL.String()).
|
||||
Int("statusCode", resp.StatusCode).Msg("couldn't find blob from url, status code")
|
||||
|
||||
return zerr.ErrSyncReferrer
|
||||
}
|
||||
|
|
|
@ -53,8 +53,8 @@ func GetUpstreamCatalog(client *http.Client, upstreamURL, username, password str
|
|||
password, &catalog,
|
||||
registryCatalogURL, "application/json", log)
|
||||
if err != nil {
|
||||
log.Error().Msgf("couldn't query %s, status code: %d, body: %s", registryCatalogURL,
|
||||
statusCode, body)
|
||||
log.Error().Str("catalog", registryCatalogURL).Int("statusCode", statusCode).
|
||||
RawJSON("body", body).Msg("couldn't query catalog")
|
||||
|
||||
return catalog, err
|
||||
}
|
||||
|
@ -67,19 +67,20 @@ func imagesToCopyFromUpstream(ctx context.Context, registryName string, repoName
|
|||
upstreamCtx *types.SystemContext, content syncconf.Content, log log.Logger,
|
||||
) ([]types.ImageReference, error) {
|
||||
imageRefs := []types.ImageReference{}
|
||||
repoRefName := fmt.Sprintf("%s/%s", registryName, repoName)
|
||||
|
||||
repoRef, err := parseRepositoryReference(fmt.Sprintf("%s/%s", registryName, repoName))
|
||||
repoRef, err := parseRepositoryReference(repoRefName)
|
||||
if err != nil {
|
||||
log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't parse repository reference: %s", repoRef)
|
||||
log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("repository reference", repoRefName).Msg("couldn't parse repository reference")
|
||||
|
||||
return imageRefs, err
|
||||
}
|
||||
|
||||
tags, err := getImageTags(ctx, upstreamCtx, repoRef)
|
||||
if err != nil {
|
||||
log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't fetch tags for %s", repoRef)
|
||||
log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("repository reference", repoRefName).Msg("couldn't fetch tags reference")
|
||||
|
||||
return imageRefs, err
|
||||
}
|
||||
|
@ -98,7 +99,7 @@ func imagesToCopyFromUpstream(ctx context.Context, registryName string, repoName
|
|||
}
|
||||
}
|
||||
|
||||
log.Debug().Msgf("repo: %s - upstream tags to be copied: %v", repoName, tags)
|
||||
log.Debug().Str("repository", repoName).Strs("tags", tags).Msg("upstream tags to be copied")
|
||||
|
||||
for _, tag := range tags {
|
||||
// don't copy cosign signature, containers/image doesn't support it
|
||||
|
@ -109,15 +110,16 @@ func imagesToCopyFromUpstream(ctx context.Context, registryName string, repoName
|
|||
|
||||
taggedRef, err := reference.WithTag(repoRef, tag)
|
||||
if err != nil {
|
||||
log.Err(err).Msgf("error creating a reference for repository %s and tag %q", repoRef.Name(), tag)
|
||||
log.Err(err).Str("repository", repoRef.Name()).Str("tag", tag).
|
||||
Msg("error creating a reference for repository and tag")
|
||||
|
||||
return imageRefs, err
|
||||
}
|
||||
|
||||
ref, err := docker.NewReference(taggedRef)
|
||||
if err != nil {
|
||||
log.Err(err).Msgf("cannot obtain a valid image reference for transport %q and reference %s",
|
||||
docker.Transport.Name(), taggedRef.String())
|
||||
log.Err(err).Str("transport", docker.Transport.Name()).Str("reference", taggedRef.String()).
|
||||
Msg("cannot obtain a valid image reference for transport and reference")
|
||||
|
||||
return imageRefs, err
|
||||
}
|
||||
|
@ -170,7 +172,7 @@ func syncRegistry(ctx context.Context, regCfg syncconf.RegistryConfig,
|
|||
policyCtx *signature.PolicyContext, credentials syncconf.Credentials,
|
||||
retryOptions *retry.RetryOptions, log log.Logger,
|
||||
) error {
|
||||
log.Info().Msgf("syncing registry: %s", upstreamURL)
|
||||
log.Info().Str("registry", upstreamURL).Msg("syncing registry")
|
||||
|
||||
var err error
|
||||
|
||||
|
@ -212,11 +214,11 @@ func syncRegistry(ctx context.Context, regCfg syncconf.RegistryConfig,
|
|||
return err
|
||||
}
|
||||
|
||||
log.Info().Msgf("filtering %d repos based on sync prefixes", len(catalog.Repositories))
|
||||
log.Info().Int("repo count", len(catalog.Repositories)).Msg("filtering repos based on sync prefixes")
|
||||
|
||||
repos := filterRepos(catalog.Repositories, regCfg.Content, log)
|
||||
|
||||
log.Info().Msgf("got repos: %v", repos)
|
||||
log.Info().Interface("repos", repos).Msg("got repos")
|
||||
|
||||
upstreamAddr := StripRegistryTransport(upstreamURL)
|
||||
|
||||
|
@ -258,8 +260,8 @@ func syncRegistry(ctx context.Context, regCfg syncconf.RegistryConfig,
|
|||
|
||||
localCachePath, err := getLocalCachePath(imageStore, localRepo)
|
||||
if err != nil {
|
||||
log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't get localCachePath for %s", localRepo)
|
||||
log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("repository", localRepo).Msg("couldn't get localCachePath for repo")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -293,7 +295,7 @@ func syncRegistry(ctx context.Context, regCfg syncconf.RegistryConfig,
|
|||
}
|
||||
}
|
||||
|
||||
log.Info().Msgf("finished syncing %s", upstreamAddr)
|
||||
log.Info().Str("upstreamAddr", upstreamAddr).Msg("finished syncing from upstream address")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -333,8 +335,8 @@ func Run(ctx context.Context, cfg syncconf.Config, repoDB repodb.RepoDB,
|
|||
if cfg.CredentialsFile != "" {
|
||||
credentialsFile, err = getFileCredentials(cfg.CredentialsFile)
|
||||
if err != nil {
|
||||
logger.Error().Str("errortype", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't get registry credentials from %s", cfg.CredentialsFile)
|
||||
logger.Error().Str("errortype", common.TypeOf(err)).Err(err).
|
||||
Str("credentialsFile", cfg.CredentialsFile).Msg("couldn't get registry credentials from credentials file")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -349,14 +351,16 @@ func Run(ctx context.Context, cfg syncconf.Config, repoDB repodb.RepoDB,
|
|||
for _, regCfg := range cfg.Registries {
|
||||
// if content not provided, don't run periodically sync
|
||||
if len(regCfg.Content) == 0 {
|
||||
logger.Info().Msgf("sync config content not configured for %v, will not run periodically sync", regCfg.URLs)
|
||||
logger.Info().Strs("registry", regCfg.URLs).
|
||||
Msg("sync config content not configured for registry, will not run periodically sync")
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// if pollInterval is not provided, don't run periodically sync
|
||||
if regCfg.PollInterval == 0 {
|
||||
logger.Warn().Msgf("sync config PollInterval not configured for %v, will not run periodically sync", regCfg.URLs)
|
||||
logger.Warn().Strs("registry", regCfg.URLs).
|
||||
Msg("sync config PollInterval not configured for registry, will not run periodically sync")
|
||||
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -1613,7 +1613,7 @@ func TestBasicAuth(t *testing.T) {
|
|||
defer dcm.StopServer()
|
||||
|
||||
found, err := test.ReadLogFileAndSearchString(dctlr.Config.Log.Output,
|
||||
"status code: 401", 15*time.Second)
|
||||
"status code\":\"401", 15*time.Second)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
@ -45,7 +45,8 @@ type ReferenceList struct {
|
|||
func getTagFromRef(ref types.ImageReference, log log.Logger) reference.Tagged {
|
||||
tagged, isTagged := ref.DockerReference().(reference.Tagged)
|
||||
if !isTagged {
|
||||
log.Warn().Msgf("internal server error, reference %s does not have a tag, skipping", ref.DockerReference())
|
||||
log.Warn().Str("reference", ref.DockerReference().String()).
|
||||
Msg("internal server error, reference does not have a tag, skipping")
|
||||
}
|
||||
|
||||
return tagged
|
||||
|
@ -76,7 +77,7 @@ func filterTagsByRegex(tags []string, regex string, log log.Logger) ([]string, e
|
|||
return filteredTags, nil
|
||||
}
|
||||
|
||||
log.Info().Msgf("start filtering using the regular expression: %s", regex)
|
||||
log.Info().Str("regex", regex).Msg("start filtering using the regular expression")
|
||||
|
||||
tagReg, err := regexp.Compile(regex)
|
||||
if err != nil {
|
||||
|
@ -267,7 +268,7 @@ func getFileCredentials(filepath string) (syncconf.CredentialsFile, error) {
|
|||
func pushSyncedLocalImage(localRepo, reference, localCachePath string,
|
||||
repoDB repodb.RepoDB, imageStore storage.ImageStore, log log.Logger,
|
||||
) error {
|
||||
log.Info().Msgf("pushing synced local image %s/%s:%s to local registry", localCachePath, localRepo, reference)
|
||||
log.Info().Str("image", localCachePath+"/"+localRepo+":"+reference).Msg("pushing synced local image to local registry")
|
||||
|
||||
var lockLatency time.Time
|
||||
|
||||
|
@ -280,7 +281,7 @@ func pushSyncedLocalImage(localRepo, reference, localCachePath string,
|
|||
if err != nil {
|
||||
log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Str("dir", path.Join(cacheImageStore.RootDir(), localRepo)).
|
||||
Msgf("couldn't find %s manifest", reference)
|
||||
Str("manifest", reference).Msg("couldn't find manifest")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -351,7 +352,8 @@ func pushSyncedLocalImage(localRepo, reference, localCachePath string,
|
|||
return fmt.Errorf("failed to set metadata for image '%s %s': %w", localRepo, reference, err)
|
||||
}
|
||||
|
||||
log.Debug().Msgf("successfully set metadata for %s:%s", localRepo, reference)
|
||||
log.Debug().Str("repository", localRepo).Str("reference", reference).
|
||||
Msg("successfully set metadata for image")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,7 +408,8 @@ func copyManifest(localRepo string, manifestContent []byte, reference string, re
|
|||
return err
|
||||
}
|
||||
|
||||
log.Debug().Msgf("successfully set metadata for %s:%s", localRepo, reference)
|
||||
log.Debug().Str("repository", localRepo).Str("reference", reference).
|
||||
Msg("successfully set metadata for image")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -543,13 +546,15 @@ func canSkipImage(repo, tag string, digest godigest.Digest, imageStore storage.I
|
|||
}
|
||||
|
||||
log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't get local image %s:%s manifest", repo, tag)
|
||||
Err(err).Str("repository", repo).Str("tag", tag).
|
||||
Msg("couldn't get local image manifest")
|
||||
|
||||
return false, err
|
||||
}
|
||||
|
||||
if localImageManifestDigest != digest {
|
||||
log.Info().Msgf("upstream image %s:%s digest changed, syncing again", repo, tag)
|
||||
log.Info().Str("repository", repo).Str("tag", tag).
|
||||
Msg("upstream image digest changed, syncing again")
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
@ -646,7 +651,8 @@ func getImageRefManifest(ctx context.Context, upstreamCtx *types.SystemContext,
|
|||
) ([]byte, string, error) {
|
||||
imageSource, err := imageRef.NewImageSource(ctx, upstreamCtx)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("couldn't get upstream image %s manifest details", imageRef.DockerReference())
|
||||
log.Error().Err(err).Str("image", imageRef.DockerReference().String()).
|
||||
Msg("couldn't get upstream image manifest details")
|
||||
|
||||
return []byte{}, "", err
|
||||
}
|
||||
|
@ -655,7 +661,8 @@ func getImageRefManifest(ctx context.Context, upstreamCtx *types.SystemContext,
|
|||
|
||||
manifestBuf, mediaType, err := imageSource.GetManifest(ctx, nil)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("couldn't get upstream image %s manifest mediaType", imageRef.DockerReference())
|
||||
log.Error().Err(err).Str("image", imageRef.DockerReference().String()).
|
||||
Msg("couldn't get upstream image manifest mediaType")
|
||||
|
||||
return []byte{}, "", err
|
||||
}
|
||||
|
@ -682,8 +689,8 @@ func syncImageWithRefs(ctx context.Context, localRepo, upstreamRepo, reference s
|
|||
if mediaType == ispec.MediaTypeArtifactManifest {
|
||||
err = sig.syncOCIArtifact(localRepo, upstreamRepo, reference, manifestBuf) //nolint
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("couldn't sync oci artifact with artifact mediaType: %s",
|
||||
upstreamImageRef.DockerReference())
|
||||
log.Error().Err(err).Str("image", upstreamImageRef.DockerReference().String()).
|
||||
Msg("couldn't sync oci artifact with artifact mediaType")
|
||||
|
||||
return skipped, err
|
||||
}
|
||||
|
@ -695,12 +702,14 @@ func syncImageWithRefs(ctx context.Context, localRepo, upstreamRepo, reference s
|
|||
// get upstream signatures
|
||||
cosignManifest, err := sig.getCosignManifest(upstreamRepo, upstreamImageDigest.String())
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("couldn't get upstream image %s cosign manifest", upstreamImageRef.DockerReference())
|
||||
log.Error().Err(err).Str("image", upstreamImageRef.DockerReference().String()).
|
||||
Msg("couldn't get upstream imagecosign manifest")
|
||||
}
|
||||
|
||||
index, err := sig.getOCIRefs(upstreamRepo, upstreamImageDigest.String())
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("couldn't get upstream image %s OCI references", upstreamImageRef.DockerReference())
|
||||
log.Error().Err(err).Str("image", upstreamImageRef.DockerReference().String()).
|
||||
Msg("couldn't get upstream image OCI references")
|
||||
}
|
||||
|
||||
// check if upstream image is signed
|
||||
|
@ -708,7 +717,8 @@ func syncImageWithRefs(ctx context.Context, localRepo, upstreamRepo, reference s
|
|||
// upstream image not signed
|
||||
if utils.enforceSignatures {
|
||||
// skip unsigned images
|
||||
log.Info().Msgf("skipping image without signature %s", upstreamImageRef.DockerReference())
|
||||
log.Info().Str("image", upstreamImageRef.DockerReference().String()).
|
||||
Msg("skipping image without signature")
|
||||
skipped = true
|
||||
|
||||
return skipped, nil
|
||||
|
@ -717,31 +727,32 @@ func syncImageWithRefs(ctx context.Context, localRepo, upstreamRepo, reference s
|
|||
|
||||
skipImage, err := canSkipImage(localRepo, upstreamImageDigest.String(), upstreamImageDigest, imageStore, log)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("couldn't check if the upstream image %s can be skipped",
|
||||
upstreamImageRef.DockerReference())
|
||||
log.Error().Err(err).Str("image", upstreamImageRef.DockerReference().String()).
|
||||
Msg("couldn't check if the upstream image can be skipped")
|
||||
}
|
||||
|
||||
if !skipImage {
|
||||
// sync image
|
||||
localImageRef, err := getLocalImageRef(localCachePath, localRepo, reference)
|
||||
if err != nil {
|
||||
log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't obtain a valid image reference for reference %s/%s:%s",
|
||||
localCachePath, localRepo, reference)
|
||||
log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("reference", localCachePath+"/"+localRepo+":"+reference).
|
||||
Msg("couldn't obtain a valid image reference for reference")
|
||||
|
||||
return skipped, err
|
||||
}
|
||||
|
||||
log.Info().Msgf("copying image %s to %s", upstreamImageRef.DockerReference(), localCachePath)
|
||||
log.Info().Str("image", upstreamImageRef.DockerReference().String()).
|
||||
Str("path", localCachePath).Msg("copying image to path")
|
||||
|
||||
if err = retry.RetryIfNecessary(ctx, func() error {
|
||||
_, err = copy.Image(ctx, utils.policyCtx, localImageRef, upstreamImageRef, &utils.copyOptions)
|
||||
|
||||
return err
|
||||
}, utils.retryOptions); err != nil {
|
||||
log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("error while copying image %s to %s",
|
||||
upstreamImageRef.DockerReference(), localCachePath)
|
||||
log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("image", upstreamImageRef.DockerReference().String()).Str("path", localCachePath).
|
||||
Msg("error while copying image to path")
|
||||
|
||||
return skipped, err
|
||||
}
|
||||
|
@ -749,14 +760,14 @@ func syncImageWithRefs(ctx context.Context, localRepo, upstreamRepo, reference s
|
|||
// push from cache to repo
|
||||
err = pushSyncedLocalImage(localRepo, reference, localCachePath, sig.repoDB, imageStore, log)
|
||||
if err != nil {
|
||||
log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("error while pushing synced cached image %s",
|
||||
fmt.Sprintf("%s/%s:%s", localCachePath, localRepo, reference))
|
||||
log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("image", localCachePath+"/"+localRepo+":"+reference).Msg("error while pushing synced cached image")
|
||||
|
||||
return skipped, err
|
||||
}
|
||||
} else {
|
||||
log.Info().Msgf("already synced image %s, checking its signatures", upstreamImageRef.DockerReference())
|
||||
log.Info().Str("image", upstreamImageRef.DockerReference().String()).
|
||||
Msg("already synced image, checking its signatures")
|
||||
}
|
||||
|
||||
// sync signatures
|
||||
|
@ -783,13 +794,13 @@ func syncImageWithRefs(ctx context.Context, localRepo, upstreamRepo, reference s
|
|||
|
||||
return nil
|
||||
}, utils.retryOptions); err != nil {
|
||||
log.Error().Str("errorType", common.TypeOf(err)).
|
||||
Err(err).Msgf("couldn't copy referrer for %s", upstreamImageRef.DockerReference())
|
||||
log.Error().Str("errorType", common.TypeOf(err)).Err(err).
|
||||
Str("image", upstreamImageRef.DockerReference().String()).Msg("couldn't copy referrer for image")
|
||||
|
||||
return skipped, err
|
||||
}
|
||||
|
||||
log.Info().Msgf("successfully synced image %s", upstreamImageRef.DockerReference())
|
||||
log.Info().Str("image", upstreamImageRef.DockerReference().String()).Msg("successfully synced image")
|
||||
|
||||
return skipped, nil
|
||||
}
|
||||
|
|
|
@ -1001,7 +1001,7 @@ func (bdw *DBWrapper) SearchRepos(ctx context.Context, searchText string, filter
|
|||
|
||||
indexDataMap[indexDigest] = indexData
|
||||
default:
|
||||
bdw.Log.Error().Msgf("Unsupported type: %s", descriptor.MediaType)
|
||||
bdw.Log.Error().Str("mediaType", descriptor.MediaType).Msg("Unsupported media type")
|
||||
|
||||
continue
|
||||
}
|
||||
|
@ -1310,7 +1310,7 @@ func (bdw *DBWrapper) FilterTags(ctx context.Context, filter repodb.FilterFunc,
|
|||
|
||||
indexDataMap[indexDigest] = indexData
|
||||
default:
|
||||
bdw.Log.Error().Msgf("Unsupported type: %s", descriptor.MediaType)
|
||||
bdw.Log.Error().Str("mediaType", descriptor.MediaType).Msg("Unsupported media type")
|
||||
|
||||
continue
|
||||
}
|
||||
|
@ -1545,7 +1545,7 @@ func (bdw *DBWrapper) SearchTags(ctx context.Context, searchText string, filter
|
|||
|
||||
indexDataMap[indexDigest] = indexData
|
||||
default:
|
||||
bdw.Log.Error().Msgf("Unsupported type: %s", descriptor.MediaType)
|
||||
bdw.Log.Error().Str("mediaType", descriptor.MediaType).Msg("Unsupported media type")
|
||||
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -898,7 +898,7 @@ func (dwr *DBWrapper) SearchRepos(ctx context.Context, searchText string, filter
|
|||
|
||||
indexDataMap[indexDigest] = indexData
|
||||
default:
|
||||
dwr.Log.Error().Msgf("Unsupported type: %s", descriptor.MediaType)
|
||||
dwr.Log.Error().Str("mediaType", descriptor.MediaType).Msg("Unsupported media type")
|
||||
|
||||
continue
|
||||
}
|
||||
|
@ -1197,7 +1197,7 @@ func (dwr *DBWrapper) FilterTags(ctx context.Context, filter repodb.FilterFunc,
|
|||
|
||||
indexDataMap[indexDigest] = indexData
|
||||
default:
|
||||
dwr.Log.Error().Msgf("Unsupported type: %s", descriptor.MediaType)
|
||||
dwr.Log.Error().Str("mediaType", descriptor.MediaType).Msg("Unsupported media type")
|
||||
|
||||
continue
|
||||
}
|
||||
|
@ -1433,7 +1433,7 @@ func (dwr *DBWrapper) SearchTags(ctx context.Context, searchText string, filter
|
|||
|
||||
indexDataMap[indexDigest] = indexData
|
||||
default:
|
||||
dwr.Log.Error().Msgf("Unsupported type: %s", descriptor.MediaType)
|
||||
dwr.Log.Error().Str("mediaType", descriptor.MediaType).Msg("Unsupported media type")
|
||||
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ func toStringIfOk(cacheDriverConfig map[string]interface{}, param string, log lo
|
|||
val, ok := cacheDriverConfig[param]
|
||||
|
||||
if !ok {
|
||||
log.Error().Msgf("parsing CacheDriver config failed, field '%s' is not present", param)
|
||||
log.Error().Str("field", param).Msg("parsing CacheDriver config failed, field is not present")
|
||||
|
||||
return "", false
|
||||
}
|
||||
|
@ -126,13 +126,13 @@ func toStringIfOk(cacheDriverConfig map[string]interface{}, param string, log lo
|
|||
str, ok := val.(string)
|
||||
|
||||
if !ok {
|
||||
log.Error().Msgf("parsing CacheDriver config failed, parameter '%s' isn't a string", param)
|
||||
log.Error().Str("parameter", param).Msg("parsing CacheDriver config failed, parameter isn't a string")
|
||||
|
||||
return "", false
|
||||
}
|
||||
|
||||
if str == "" {
|
||||
log.Error().Msgf("parsing CacheDriver config failed, field '%s' is empty", param)
|
||||
log.Error().Str("field", param).Msg("parsing CacheDriver config failed, field is empty")
|
||||
|
||||
return "", false
|
||||
}
|
||||
|
|
|
@ -19,7 +19,8 @@ func ParseStorage(repoDB RepoDB, storeController storage.StoreController, log lo
|
|||
allRepos, err := getAllRepos(storeController)
|
||||
if err != nil {
|
||||
rootDir := storeController.DefaultStore.RootDir()
|
||||
log.Error().Err(err).Msgf("load-local-layout: failed to get all repo names present under %s", rootDir)
|
||||
log.Error().Err(err).Str("rootDir", rootDir).
|
||||
Msg("load-local-layout: failed to get all repo names present under rootDir")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -27,7 +28,7 @@ func ParseStorage(repoDB RepoDB, storeController storage.StoreController, log lo
|
|||
for _, repo := range allRepos {
|
||||
err := ParseRepo(repo, repoDB, storeController, log)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("load-local-layout: failed to sync repo %s", repo)
|
||||
log.Error().Err(err).Str("repository", repo).Msg("load-local-layout: failed to sync repo")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -42,7 +43,7 @@ func ParseRepo(repo string, repoDB RepoDB, storeController storage.StoreControll
|
|||
|
||||
indexBlob, err := imageStore.GetIndexContent(repo)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("load-repo: failed to read index.json for repo %s", repo)
|
||||
log.Error().Err(err).Str("repository", repo).Msg("load-repo: failed to read index.json for repo")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -51,14 +52,14 @@ func ParseRepo(repo string, repoDB RepoDB, storeController storage.StoreControll
|
|||
|
||||
err = json.Unmarshal(indexBlob, &indexContent)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("load-repo: failed to unmarshal index.json for repo %s", repo)
|
||||
log.Error().Err(err).Str("repository", repo).Msg("load-repo: failed to unmarshal index.json for repo")
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
err = resetRepoMetaTags(repo, repoDB, log)
|
||||
if err != nil && !errors.Is(err, zerr.ErrRepoMetaNotFound) {
|
||||
log.Error().Err(err).Msgf("load-repo: failed to reset tag field in RepoMetadata for repo %s", repo)
|
||||
log.Error().Err(err).Str("repository", repo).Msg("load-repo: failed to reset tag field in RepoMetadata for repo")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -78,7 +79,7 @@ func ParseRepo(repo string, repoDB RepoDB, storeController storage.StoreControll
|
|||
|
||||
manifestMetaIsPresent, err := isManifestMetaPresent(repo, manifest, repoDB)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("load-repo: error checking manifestMeta in RepoDB")
|
||||
log.Error().Err(err).Msg("load-repo: error checking manifestMeta in RepoDB")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -86,7 +87,7 @@ func ParseRepo(repo string, repoDB RepoDB, storeController storage.StoreControll
|
|||
if manifestMetaIsPresent && hasTag {
|
||||
err = repoDB.SetRepoReference(repo, tag, manifest.Digest, manifest.MediaType)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("load-repo: failed to set repo tag for %s:%s", repo, tag)
|
||||
log.Error().Err(err).Str("repository", repo).Str("tag", tag).Msg("load-repo: failed to set repo tag")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -96,7 +97,8 @@ func ParseRepo(repo string, repoDB RepoDB, storeController storage.StoreControll
|
|||
|
||||
manifestBlob, digest, _, err := imageStore.GetImageManifest(repo, manifest.Digest.String())
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("load-repo: failed to set repo tag for %s:%s", repo, tag)
|
||||
log.Error().Err(err).Str("repository", repo).Str("tag", tag).
|
||||
Msg("load-repo: failed to set repo tag for image")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -107,7 +109,8 @@ func ParseRepo(repo string, repoDB RepoDB, storeController storage.StoreControll
|
|||
if errors.Is(err, zerr.ErrOrphanSignature) {
|
||||
continue
|
||||
} else {
|
||||
log.Error().Err(err).Msgf("load-repo: failed checking if image is signature for %s:%s", repo, tag)
|
||||
log.Error().Err(err).Str("repository", repo).Str("tag", tag).
|
||||
Msg("load-repo: failed checking if image is signature for specified image")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -136,7 +139,8 @@ func ParseRepo(repo string, repoDB RepoDB, storeController storage.StoreControll
|
|||
err = SetMetadataFromInput(repo, reference, manifest.MediaType, manifest.Digest, manifestBlob,
|
||||
imageStore, repoDB, log)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("load-repo: failed to set metadata for %s:%s", repo, tag)
|
||||
log.Error().Err(err).Str("repository", repo).Str("tag", tag).
|
||||
Msg("load-repo: failed to set metadata for image")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -150,8 +154,9 @@ func ParseRepo(repo string, repoDB RepoDB, storeController storage.StoreControll
|
|||
SignatureDigest: sigData.signatureDigest,
|
||||
})
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("load-repo: failed set signature meta for signed image %s:%s manifest digest %s ",
|
||||
sigData.repo, sigData.tag, sigData.signedManifestDigest)
|
||||
log.Error().Err(err).Str("repository", sigData.repo).Str("tag", sigData.tag).
|
||||
Str("manifestDigest", sigData.signedManifestDigest).
|
||||
Msg("load-repo: failed set signature meta for signed image manifest digest")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -164,13 +169,13 @@ func ParseRepo(repo string, repoDB RepoDB, storeController storage.StoreControll
|
|||
func resetRepoMetaTags(repo string, repoDB RepoDB, log log.Logger) error {
|
||||
repoMeta, err := repoDB.GetRepoMeta(repo)
|
||||
if err != nil && !errors.Is(err, zerr.ErrRepoMetaNotFound) {
|
||||
log.Error().Err(err).Msgf("load-repo: failed to get RepoMeta for repo %s", repo)
|
||||
log.Error().Err(err).Str("repository", repo).Msg("load-repo: failed to get RepoMeta for repo")
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
if errors.Is(err, zerr.ErrRepoMetaNotFound) {
|
||||
log.Info().Msgf("load-repo: RepoMeta not found for repo %s, new RepoMeta will be created", repo)
|
||||
log.Info().Str("repository", repo).Msg("load-repo: RepoMeta not found for repo, new RepoMeta will be created")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ func OnUpdateManifest(repo, reference, mediaType string, digest godigest.Digest,
|
|||
log.Error().Err(err).Msg("can't check if image is a signature or not")
|
||||
|
||||
if err := imgStore.DeleteImageManifest(repo, reference, false); err != nil {
|
||||
log.Error().Err(err).Msgf("couldn't remove image manifest %s in repo %s", reference, repo)
|
||||
log.Error().Err(err).Str("manifest", reference).Str("repository", repo).Msg("couldn't remove image manifest in repo")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -61,10 +61,11 @@ func OnUpdateManifest(repo, reference, mediaType string, digest godigest.Digest,
|
|||
}
|
||||
|
||||
if !metadataSuccessfullySet {
|
||||
log.Info().Msgf("uploding image meta was unsuccessful for tag %s in repo %s", reference, repo)
|
||||
log.Info().Str("tag", reference).Str("repository", repo).Msg("uploding image meta was unsuccessful for tag in repo")
|
||||
|
||||
if err := imgStore.DeleteImageManifest(repo, reference, false); err != nil {
|
||||
log.Error().Err(err).Msgf("couldn't remove image manifest %s in repo %s", reference, repo)
|
||||
log.Error().Err(err).Str("reference", reference).Str("repository", repo).
|
||||
Msg("couldn't remove image manifest in repo")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -133,7 +134,8 @@ func OnDeleteManifest(repo, reference, mediaType string, digest godigest.Digest,
|
|||
}
|
||||
|
||||
if !manageRepoMetaSuccessfully {
|
||||
log.Info().Msgf("repodb: deleting image meta was unsuccessful for tag %s in repo %s", reference, repo)
|
||||
log.Info().Str("tag", reference).Str("repository", repo).
|
||||
Msg("repodb: deleting image meta was unsuccessful for tag in repo")
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -163,7 +165,8 @@ func OnGetManifest(name, reference string, digest godigest.Digest, body []byte,
|
|||
if !isSignature {
|
||||
err := repoDB.IncrementImageDownloads(name, reference)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("unexpected error for '%s:%s'", name, reference)
|
||||
log.Error().Err(err).Str("repository", name).Str("reference", reference).
|
||||
Msg("unexpected error for image")
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
2
pkg/storage/cache/boltdb.go
vendored
2
pkg/storage/cache/boltdb.go
vendored
|
@ -35,7 +35,7 @@ func NewBoltDBCache(parameters interface{}, log zlog.Logger) Cache {
|
|||
|
||||
err := os.MkdirAll(properParameters.RootDir, constants.DefaultDirPerms)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("unable to create directory for cache db: %v", properParameters.RootDir)
|
||||
log.Error().Err(err).Str("directory", properParameters.RootDir).Msg("unable to create directory for cache db")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
8
pkg/storage/cache/dynamodb.go
vendored
8
pkg/storage/cache/dynamodb.go
vendored
|
@ -83,7 +83,7 @@ func NewDynamoDBCache(parameters interface{}, log zlog.Logger) Cache {
|
|||
cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion(properParameters.Region),
|
||||
config.WithEndpointResolverWithOptions(customResolver))
|
||||
if err != nil {
|
||||
log.Error().Msgf("unable to load AWS SDK config for dynamodb, %v", err)
|
||||
log.Error().Err(err).Msg("unable to load AWS SDK config for dynamodb")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ func NewDynamoDBCache(parameters interface{}, log zlog.Logger) Cache {
|
|||
|
||||
err = driver.NewTable(driver.tableName)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("unable to create table for cache '%s'", driver.tableName)
|
||||
log.Error().Err(err).Str("tableName", driver.tableName).Msg("unable to create table for cache")
|
||||
}
|
||||
|
||||
// Using the Config value, create the DynamoDB client
|
||||
|
@ -112,7 +112,7 @@ func (d *DynamoDBDriver) GetBlob(digest godigest.Digest) (string, error) {
|
|||
},
|
||||
})
|
||||
if err != nil {
|
||||
d.log.Error().Msgf("failed to get blob %v, %v", d.tableName, err)
|
||||
d.log.Error().Err(err).Str("tableName", d.tableName).Msg("failed to get blob")
|
||||
|
||||
return "", err
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ func (d *DynamoDBDriver) HasBlob(digest godigest.Digest, path string) bool {
|
|||
},
|
||||
})
|
||||
if err != nil {
|
||||
d.log.Error().Msgf("failed to get blob %v, %v", d.tableName, err)
|
||||
d.log.Error().Err(err).Str("tableName", d.tableName).Msg("failed to get blob")
|
||||
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -868,7 +868,7 @@ func (dt *dedupeTask) DoWork() error {
|
|||
err := dt.imgStore.RunDedupeForDigest(dt.digest, dt.dedupe, dt.duplicateBlobs)
|
||||
if err != nil {
|
||||
// log it
|
||||
dt.log.Error().Err(err).Msgf("rebuild dedupe: failed to rebuild digest %s", dt.digest.String())
|
||||
dt.log.Error().Err(err).Str("digest", dt.digest.String()).Msg("rebuild dedupe: failed to rebuild digest")
|
||||
}
|
||||
|
||||
return err
|
||||
|
|
|
@ -157,7 +157,7 @@ func (is *ImageStoreLocal) initRepo(name string) error {
|
|||
}
|
||||
|
||||
if !zreg.FullNameRegexp.MatchString(name) {
|
||||
is.log.Error().Str("repo", name).Msg("invalid repository name")
|
||||
is.log.Error().Str("repository", name).Msg("invalid repository name")
|
||||
|
||||
return zerr.ErrInvalidRepositoryName
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ func (is *ImageStoreLocal) PutImageManifest(repo, reference, mediaType string, /
|
|||
// apply linter only on images, not signatures
|
||||
pass, err := storage.ApplyLinter(is, is.linter, repo, desc)
|
||||
if !pass {
|
||||
is.log.Error().Err(err).Str("repo", repo).Str("reference", reference).Msg("linter didn't pass")
|
||||
is.log.Error().Err(err).Str("repository", repo).Str("reference", reference).Msg("linter didn't pass")
|
||||
|
||||
return "", err
|
||||
}
|
||||
|
@ -821,7 +821,7 @@ func (is *ImageStoreLocal) FinishBlobUpload(repo, uuid string, body io.Reader, d
|
|||
|
||||
_, err = io.Copy(digester, blobFile)
|
||||
if err != nil {
|
||||
is.log.Error().Err(err).Str("repo", repo).Str("blob", src).Str("digest", dstDigest.String()).
|
||||
is.log.Error().Err(err).Str("repository", repo).Str("blob", src).Str("digest", dstDigest.String()).
|
||||
Msg("unable to compute hash")
|
||||
|
||||
return err
|
||||
|
@ -1143,7 +1143,7 @@ func (is *ImageStoreLocal) checkCacheBlob(digest godigest.Digest) (string, error
|
|||
|
||||
func (is *ImageStoreLocal) copyBlob(repo, blobPath, dstRecord string) (int64, error) {
|
||||
if err := is.initRepo(repo); err != nil {
|
||||
is.log.Error().Err(err).Str("repo", repo).Msg("unable to initialize an empty repo")
|
||||
is.log.Error().Err(err).Str("repository", repo).Msg("unable to initialize an empty repo")
|
||||
|
||||
return -1, err
|
||||
}
|
||||
|
@ -1464,7 +1464,7 @@ func (is *ImageStoreLocal) garbageCollect(dir string, repo string) error {
|
|||
case ispec.MediaTypeImageIndex:
|
||||
indexImage, err := storage.GetImageIndex(is, repo, desc.Digest, is.log)
|
||||
if err != nil {
|
||||
is.log.Error().Err(err).Str("repo", repo).Str("digest", desc.Digest.String()).
|
||||
is.log.Error().Err(err).Str("repository", repo).Str("digest", desc.Digest.String()).
|
||||
Msg("gc: failed to read multiarch(index) image")
|
||||
|
||||
return err
|
||||
|
@ -1530,7 +1530,7 @@ func gcUntaggedManifests(imgStore *ImageStoreLocal, oci casext.Engine, index *is
|
|||
// check if is indeed an image and not an artifact by checking it's config blob
|
||||
buf, err := imgStore.GetBlobContent(repo, desc.Digest)
|
||||
if err != nil {
|
||||
imgStore.log.Error().Err(err).Str("repo", repo).Str("digest", desc.Digest.String()).
|
||||
imgStore.log.Error().Err(err).Str("repository", repo).Str("digest", desc.Digest.String()).
|
||||
Msg("gc: failed to read image manifest")
|
||||
|
||||
return err
|
||||
|
@ -1554,18 +1554,19 @@ func gcUntaggedManifests(imgStore *ImageStoreLocal, oci casext.Engine, index *is
|
|||
// remove manifest if it's older than gc.delay
|
||||
canGC, err := isBlobOlderThan(imgStore, repo, desc.Digest, imgStore.gcDelay)
|
||||
if err != nil {
|
||||
imgStore.log.Error().Err(err).Str("repo", repo).Str("digest", desc.Digest.String()).
|
||||
Msgf("gc: failed to check if blob is older than %s", imgStore.gcDelay.String())
|
||||
imgStore.log.Error().Err(err).Str("repository", repo).Str("digest", desc.Digest.String()).
|
||||
Str("delay", imgStore.gcDelay.String()).Msg("gc: failed to check if blob is older than delay")
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
if canGC {
|
||||
imgStore.log.Info().Str("repo", repo).Str("digest", desc.Digest.String()).Msg("gc: removing manifest without tag")
|
||||
imgStore.log.Info().Str("repository", repo).Str("digest", desc.Digest.String()).
|
||||
Msg("gc: removing manifest without tag")
|
||||
|
||||
_, err = storage.RemoveManifestDescByReference(index, desc.Digest.String(), true)
|
||||
if errors.Is(err, zerr.ErrManifestConflict) {
|
||||
imgStore.log.Info().Str("repo", repo).Str("digest", desc.Digest.String()).
|
||||
imgStore.log.Info().Str("repository", repo).Str("digest", desc.Digest.String()).
|
||||
Msg("gc: skipping removing manifest due to conflict")
|
||||
|
||||
continue
|
||||
|
@ -1598,7 +1599,7 @@ func gcCosignSignatures(imgStore *ImageStoreLocal, oci casext.Engine, index *isp
|
|||
|
||||
if !foundSubject {
|
||||
// remove manifest
|
||||
imgStore.log.Info().Str("repo", repo).Str("digest", cosignDesc.Digest.String()).
|
||||
imgStore.log.Info().Str("repository", repo).Str("digest", cosignDesc.Digest.String()).
|
||||
Msg("gc: removing cosign signature without subject")
|
||||
|
||||
// no need to check for manifest conflict, if one doesn't have a subject, then none with same digest will have
|
||||
|
@ -1624,14 +1625,14 @@ func gcNotationSignatures(imgStore *ImageStoreLocal, oci casext.Engine, index *i
|
|||
|
||||
buf, err := imgStore.GetBlobContent(repo, notationDesc.Digest)
|
||||
if err != nil {
|
||||
imgStore.log.Error().Err(err).Str("repo", repo).Str("digest", notationDesc.Digest.String()).
|
||||
imgStore.log.Error().Err(err).Str("repository", repo).Str("digest", notationDesc.Digest.String()).
|
||||
Msg("gc: failed to get oras artifact manifest")
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(buf, &artManifest); err != nil {
|
||||
imgStore.log.Error().Err(err).Str("repo", repo).Str("digest", notationDesc.Digest.String()).
|
||||
imgStore.log.Error().Err(err).Str("repository", repo).Str("digest", notationDesc.Digest.String()).
|
||||
Msg("gc: failed to get oras artifact manifest")
|
||||
|
||||
return err
|
||||
|
@ -1650,7 +1651,7 @@ func gcNotationSignatures(imgStore *ImageStoreLocal, oci casext.Engine, index *i
|
|||
|
||||
if !foundSubject {
|
||||
// remove manifest
|
||||
imgStore.log.Info().Str("repo", repo).Str("digest", notationDesc.Digest.String()).
|
||||
imgStore.log.Info().Str("repository", repo).Str("digest", notationDesc.Digest.String()).
|
||||
Msg("gc: removing notation signature without subject")
|
||||
|
||||
// no need to check for manifest conflict, if one doesn't have a subject, then none with same digest will have
|
||||
|
@ -1828,7 +1829,7 @@ func (is *ImageStoreLocal) dedupeBlobs(digest godigest.Digest, duplicateBlobs []
|
|||
return zerr.ErrDedupeRebuild
|
||||
}
|
||||
|
||||
is.log.Info().Str("digest", digest.String()).Msgf("rebuild dedupe: deduping blobs for digest")
|
||||
is.log.Info().Str("digest", digest.String()).Msg("rebuild dedupe: deduping blobs for digest")
|
||||
|
||||
var originalBlob string
|
||||
|
||||
|
@ -1909,7 +1910,7 @@ func (is *ImageStoreLocal) dedupeBlobs(digest godigest.Digest, duplicateBlobs []
|
|||
}
|
||||
}
|
||||
|
||||
is.log.Info().Str("digest", digest.String()).Msgf("rebuild dedupe: deduping blobs for digest finished successfully")
|
||||
is.log.Info().Str("digest", digest.String()).Msg("rebuild dedupe: deduping blobs for digest finished successfully")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ func (is *ObjectStorage) initRepo(name string) error {
|
|||
repoDir := path.Join(is.rootDir, name)
|
||||
|
||||
if !zreg.FullNameRegexp.MatchString(name) {
|
||||
is.log.Error().Str("repo", name).Msg("invalid repository name")
|
||||
is.log.Error().Str("repository", name).Msg("invalid repository name")
|
||||
|
||||
return zerr.ErrInvalidRepositoryName
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ func (is *ObjectStorage) PutImageManifest(repo, reference, mediaType string, //n
|
|||
// apply linter only on images, not signatures
|
||||
pass, err := storage.ApplyLinter(is, is.linter, repo, desc)
|
||||
if !pass {
|
||||
is.log.Error().Err(err).Str("repo", repo).Str("reference", reference).Msg("linter didn't pass")
|
||||
is.log.Error().Err(err).Str("repository", repo).Str("reference", reference).Msg("linter didn't pass")
|
||||
|
||||
return "", err
|
||||
}
|
||||
|
@ -1037,7 +1037,7 @@ func (is *ObjectStorage) checkCacheBlob(digest godigest.Digest) (string, error)
|
|||
|
||||
func (is *ObjectStorage) copyBlob(repo string, blobPath, dstRecord string) (int64, error) {
|
||||
if err := is.initRepo(repo); err != nil {
|
||||
is.log.Error().Err(err).Str("repo", repo).Msg("unable to initialize an empty repo")
|
||||
is.log.Error().Err(err).Str("repository", repo).Msg("unable to initialize an empty repo")
|
||||
|
||||
return -1, err
|
||||
}
|
||||
|
@ -1481,7 +1481,7 @@ func (is *ObjectStorage) getOriginalBlob(digest godigest.Digest, duplicateBlobs
|
|||
}
|
||||
}
|
||||
|
||||
is.log.Info().Msgf("rebuild dedupe: found original blob %s", originalBlob)
|
||||
is.log.Info().Str("originalBlob", originalBlob).Msg("rebuild dedupe: found original blob")
|
||||
|
||||
return originalBlob, nil
|
||||
}
|
||||
|
@ -1493,7 +1493,7 @@ func (is *ObjectStorage) dedupeBlobs(digest godigest.Digest, duplicateBlobs []st
|
|||
return zerr.ErrDedupeRebuild
|
||||
}
|
||||
|
||||
is.log.Info().Str("digest", digest.String()).Msgf("rebuild dedupe: deduping blobs for digest")
|
||||
is.log.Info().Str("digest", digest.String()).Msg("rebuild dedupe: deduping blobs for digest")
|
||||
|
||||
var originalBlob string
|
||||
|
||||
|
@ -1554,13 +1554,13 @@ func (is *ObjectStorage) dedupeBlobs(digest godigest.Digest, duplicateBlobs []st
|
|||
}
|
||||
}
|
||||
|
||||
is.log.Info().Str("digest", digest.String()).Msgf("rebuild dedupe: deduping blobs for digest finished successfully")
|
||||
is.log.Info().Str("digest", digest.String()).Msg("rebuild dedupe: deduping blobs for digest finished successfully")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (is *ObjectStorage) restoreDedupedBlobs(digest godigest.Digest, duplicateBlobs []string) error {
|
||||
is.log.Info().Str("digest", digest.String()).Msgf("rebuild dedupe: restoring deduped blobs for digest")
|
||||
is.log.Info().Str("digest", digest.String()).Msg("rebuild dedupe: restoring deduped blobs for digest")
|
||||
|
||||
// first we need to find the original blob, either in cache or by checking each blob size
|
||||
originalBlob, err := is.getOriginalBlob(digest, duplicateBlobs)
|
||||
|
@ -1596,7 +1596,7 @@ func (is *ObjectStorage) restoreDedupedBlobs(digest godigest.Digest, duplicateBl
|
|||
}
|
||||
|
||||
is.log.Info().Str("digest", digest.String()).
|
||||
Msgf("rebuild dedupe: restoring deduped blobs for digest finished successfully")
|
||||
Msg("rebuild dedupe: restoring deduped blobs for digest finished successfully")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ func (olu BaseOciLayoutUtils) checkNotarySignature(name string, digest godigest.
|
|||
|
||||
referrers, err := imageStore.GetReferrers(name, digest, []string{mediaType})
|
||||
if err != nil {
|
||||
olu.Log.Info().Err(err).Str("repo", name).Str("digest",
|
||||
olu.Log.Info().Err(err).Str("repository", name).Str("digest",
|
||||
digest.String()).Str("mediatype", mediaType).Msg("invalid notary signature")
|
||||
|
||||
return false
|
||||
|
@ -264,7 +264,7 @@ func (olu BaseOciLayoutUtils) checkCosignSignature(name string, digest godigest.
|
|||
|
||||
_, _, _, err := imageStore.GetImageManifest(name, reference) //nolint: dogsled
|
||||
if err != nil {
|
||||
olu.Log.Info().Err(err).Str("repo", name).Str("digest",
|
||||
olu.Log.Info().Err(err).Str("repository", name).Str("digest",
|
||||
digest.String()).Msg("invalid cosign signature")
|
||||
|
||||
return false
|
||||
|
@ -362,7 +362,7 @@ func (olu BaseOciLayoutUtils) GetExpandedRepoInfo(repoName string) (common.RepoI
|
|||
|
||||
lastUpdatedTag, err := olu.GetRepoLastUpdated(repoName)
|
||||
if err != nil {
|
||||
olu.Log.Error().Err(err).Msgf("can't get last updated manifest for repo: %s", repoName)
|
||||
olu.Log.Error().Err(err).Str("repository", repoName).Msg("can't get last updated manifest for repo")
|
||||
|
||||
return common.RepoInfo{}, err
|
||||
}
|
||||
|
@ -377,8 +377,8 @@ func (olu BaseOciLayoutUtils) GetExpandedRepoInfo(repoName string) (common.RepoI
|
|||
|
||||
tag, ok := man.Annotations[ispec.AnnotationRefName]
|
||||
if !ok {
|
||||
olu.Log.Info().Msgf("skipping manifest with digest %s because it doesn't have a tag",
|
||||
man.Digest.String())
|
||||
olu.Log.Info().Str("digest", man.Digest.String()).
|
||||
Msg("skipping manifest with digest because it doesn't have a tag")
|
||||
|
||||
continue
|
||||
}
|
||||
|
@ -401,7 +401,8 @@ func (olu BaseOciLayoutUtils) GetExpandedRepoInfo(repoName string) (common.RepoI
|
|||
|
||||
imageConfigInfo, err := olu.GetImageConfigInfo(repoName, man.Digest)
|
||||
if err != nil {
|
||||
olu.Log.Error().Err(err).Msgf("can't retrieve config info for the image %s %s", repoName, man.Digest)
|
||||
olu.Log.Error().Err(err).Str("repository", repoName).Str("manifest digest", man.Digest.String()).
|
||||
Msg("can't retrieve config info for the image")
|
||||
|
||||
continue
|
||||
}
|
||||
|
@ -472,8 +473,8 @@ func (olu BaseOciLayoutUtils) GetExpandedRepoInfo(repoName string) (common.RepoI
|
|||
}
|
||||
|
||||
if layersIterator+1 > len(layers) {
|
||||
olu.Log.Error().Err(zerr.ErrBadLayerCount).
|
||||
Msgf("error on creating layer history for image %s %s", repoName, man.Digest)
|
||||
olu.Log.Error().Err(err).Str("repository", repoName).Str("manifest digest", man.Digest.String()).
|
||||
Msg("error on creating layer history for image")
|
||||
|
||||
break
|
||||
}
|
||||
|
@ -484,7 +485,7 @@ func (olu BaseOciLayoutUtils) GetExpandedRepoInfo(repoName string) (common.RepoI
|
|||
}
|
||||
}
|
||||
|
||||
olu.Log.Debug().Msgf("all history %v", allHistory)
|
||||
olu.Log.Debug().Interface("history", allHistory).Msg("all history")
|
||||
|
||||
size := strconv.Itoa(int(imageSize))
|
||||
manifestDigest := man.Digest.String()
|
||||
|
|
Loading…
Reference in a new issue