Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: revert "org.opencontainers.referrers.filtersApplied" #1478

Merged
merged 1 commit into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions pkg/storage/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}

Expand Down
31 changes: 15 additions & 16 deletions pkg/storage/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)