From 2202d6dfd49470ca76af59989ad9bb4007eda166 Mon Sep 17 00:00:00 2001 From: Ramkumar Chinchani <45800463+rchincha@users.noreply.github.com> Date: Fri, 26 May 2023 13:56:44 -0700 Subject: [PATCH] fix: revert "org.opencontainers.referrers.filtersApplied" (#1478) As per latest dist-spec, this is now removed. Signed-off-by: Ramkumar Chinchani --- pkg/storage/common/common.go | 26 ------------------------- pkg/storage/constants/constants.go | 31 +++++++++++++++--------------- 2 files changed, 15 insertions(+), 42 deletions(-) diff --git a/pkg/storage/common/common.go b/pkg/storage/common/common.go index 558fa4f0..9316ab1c 100644 --- a/pkg/storage/common/common.go +++ b/pkg/storage/common/common.go @@ -560,26 +560,6 @@ func GetOrasReferrers(imgStore storageTypes.ImageStore, repo string, gdigest god return result, nil } -func getReferrerFilterAnnotation(artifactTypes []string) string { - // as per spec, return what filters were applied as an annotation if artifactTypes - annotation := "" - - for _, artifactType := range artifactTypes { - if artifactType == "" { - // ignore empty artifactTypes - continue - } - - if annotation == "" { - annotation = artifactType - } else { - annotation += "," + artifactType - } - } - - return annotation -} - func GetReferrers(imgStore storageTypes.ImageStore, repo string, gdigest godigest.Digest, artifactTypes []string, log zerolog.Logger, ) (ispec.Index, error) { @@ -653,12 +633,6 @@ func GetReferrers(imgStore storageTypes.ImageStore, repo string, gdigest godiges Annotations: map[string]string{}, } - // as per spec, return what filters were applied as an annotation if artifactTypes - if annotation := getReferrerFilterAnnotation(artifactTypes); annotation != "" { - index.Annotations[storageConstants.ReferrerFilterAnnotation] = annotation - log.Info().Str("annotation", annotation).Msg("filters applied") - } - return index, nil } diff --git a/pkg/storage/constants/constants.go b/pkg/storage/constants/constants.go index 06a0c41d..2a7df48a 100644 --- a/pkg/storage/constants/constants.go +++ b/pkg/storage/constants/constants.go @@ -6,20 +6,19 @@ import ( const ( // BlobUploadDir defines the upload directory for blob uploads. - BlobUploadDir = ".uploads" - SchemaVersion = 2 - DefaultFilePerms = 0o600 - DefaultDirPerms = 0o700 - RLOCK = "RLock" - RWLOCK = "RWLock" - BlobsCache = "blobs" - DuplicatesBucket = "duplicates" - OriginalBucket = "original" - DBExtensionName = ".db" - DBCacheLockCheckTimeout = 10 * time.Second - BoltdbName = "cache" - ReferrerFilterAnnotation = "org.opencontainers.referrers.filtersApplied" - DynamoDBDriverName = "dynamodb" - DefaultGCDelay = 1 * time.Hour - S3StorageDriverName = "s3" + BlobUploadDir = ".uploads" + SchemaVersion = 2 + DefaultFilePerms = 0o600 + DefaultDirPerms = 0o700 + RLOCK = "RLock" + RWLOCK = "RWLock" + BlobsCache = "blobs" + DuplicatesBucket = "duplicates" + OriginalBucket = "original" + DBExtensionName = ".db" + DBCacheLockCheckTimeout = 10 * time.Second + BoltdbName = "cache" + DynamoDBDriverName = "dynamodb" + DefaultGCDelay = 1 * time.Hour + S3StorageDriverName = "s3" )