0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00
zot/pkg/extensions/search/schema.graphql
Andrei Aaron e8e7c343ad
feat(repodb): add pagination for ImageListForDigest and implement FilterTags (#1102)
* feat(repodb): add pagination for ImageListForDigest and implement FilterTags

ImageListForDigest can now return paginated results, directly from DB.
It uses FilterTags, a new method to filter tags (obviously) based on
the criteria provided in the filter function.
Pagination of tags is now slightly different, it shows all results if
no limit and offset are provided.

Signed-off-by: Alex Stan <alexandrustan96@yahoo.ro>

bug(tests): cli tests for digests expecting wrong size

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
(cherry picked from commit 369216df931a4053c18278a8d89f86d2e1e6a436)

fix(repodb): do not include repo metadata in search results if no matching tags are identified

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

* fix(repodb): Fix an issue in FilterTags where repometa was not proceesed correctly

The filter function was called only once per manifest digest.
The function is supposed to also take into consideration repometa,
but only the first repometa-manifestmeta pair was processed.

Also increase code coverage.

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
Co-authored-by: Alex Stan <alexandrustan96@yahoo.ro>
2023-01-18 00:31:54 +02:00

250 lines
5.5 KiB
GraphQL

scalar Time
"""
Contains the tag of the image and a list of CVEs
"""
type CVEResultForImage {
Tag: String
CVEList: [CVE]
}
"""
Contains various details about the CVE and a list of PackageInfo about the affected packages
"""
type CVE {
Id: String
Title: String
Description: String
Severity: String
PackageList: [PackageInfo]
}
"""
Contains the name of the package, the current installed version and the version where the CVE was fixed
"""
type PackageInfo {
Name: String
InstalledVersion: String
FixedVersion: String
}
"""
Contains details about the repo: a list of image summaries and a summary of the repo
"""
type RepoInfo {
Images: [ImageSummary]
Summary: RepoSummary
}
# Search results in all repos/images/layers
# There will be other more structures for more detailed information
"""
Search everything. Can search Images, Repos and Layers
"""
type GlobalSearchResult {
Page: PageInfo
Images: [ImageSummary]
Repos: [RepoSummary]
Layers: [LayerSummary]
}
# Brief on a specific image to be used in queries returning a list of images
# We define an image as a pairing or a repo and a tag belonging to that repo
"""
Contains details about the image
"""
type ImageSummary {
RepoName: String
Tag: String
Digest: String
ConfigDigest: String
LastUpdated: Time
IsSigned: Boolean
Size: String
Platform: OsArch
Vendor: String
Score: Int
DownloadCount: Int
Layers: [LayerSummary]
Description: String
Licenses: String # The value of the annotation if present, 'unknown' otherwise).
Labels: String
Title: String
Source: String
Documentation: String
History: [LayerHistory]
Vulnerabilities: ImageVulnerabilitySummary
Authors: String
}
type ImageVulnerabilitySummary {
MaxSeverity: String
Count: Int
}
# Brief on a specific repo to be used in queries returning a list of repos
"""
Contains details about the repo
"""
type RepoSummary {
Name: String
LastUpdated: Time
Size: String
Platforms: [OsArch]
Vendors: [String]
Score: Int
NewestImage: ImageSummary # Newest based on created timestamp
DownloadCount: Int
StarCount: Int
IsBookmarked: Boolean
IsStarred: Boolean
}
# Currently the same as LayerInfo, we can refactor later
# For detailed information on the layer a ImageListForDigest call can be made
"""
Contains details about the layer
"""
type LayerSummary {
Size: String # Int64 is not supported.
Digest: String
Score: Int
}
type HistoryDescription {
Created: Time
"""
CreatedBy is the command which created the layer.
"""
CreatedBy: String
"""
Author is the author of the build point.
"""
Author: String
"""
Comment is a custom message set when creating the layer.
"""
Comment: String
"""
EmptyLayer is used to mark if the history item created a filesystem diff.
"""
EmptyLayer: Boolean
}
type LayerHistory {
Layer: LayerSummary
HistoryDescription: HistoryDescription
}
type Annotation {
Key: String
Value: String
}
type Referrer {
MediaType: String
ArtifactType: String
Size: Int
Digest: String
Annotations: [Annotation]!
}
"""
Contains details about the supported OS and architecture of the image
"""
type OsArch {
Os: String
Arch: String
}
enum SortCriteria {
RELEVANCE
UPDATE_TIME
ALPHABETIC_ASC
ALPHABETIC_DSC
STARS
DOWNLOADS
}
type PageInfo {
ObjectCount: Int!
PreviousPage: Int
NextPage: Int
Pages: Int
}
# Pagination parameters
input PageInput {
limit: Int
offset: Int
sortBy: SortCriteria
}
input Filter {
Os: [String]
Arch: [String]
HasToBeSigned: Boolean
}
type Query {
"""
Returns a CVE list for the image specified in the arugment
"""
CVEListForImage(image: String!): CVEResultForImage!
"""
Returns a list of images vulnerable to the CVE of the specified ID
"""
ImageListForCVE(id: String!): [ImageSummary!]
"""
Returns a list of images that are no longer vulnerable to the CVE of the specified ID, from the specified image (repo)
"""
ImageListWithCVEFixed(id: String!, image: String!): [ImageSummary!]
"""
Returns a list of images which contain the specified digest
"""
ImageListForDigest(id: String!, requestedPage: PageInput): [ImageSummary!]
"""
Returns a list of repos with the newest tag within
"""
RepoListWithNewestImage(requestedPage: PageInput): [RepoSummary!]! # Newest based on created timestamp
"""
Returns all the images from the specified repo
"""
ImageList(repo: String!): [ImageSummary!]
"""
Returns information about the specified repo
"""
ExpandedRepoInfo(repo: String!): RepoInfo!
"""
Searches within repos, images, and layers
"""
GlobalSearch(query: String!, filter: Filter, requestedPage: PageInput): GlobalSearchResult!
"""
List of images which use the argument image
"""
DerivedImageList(image: String!): [ImageSummary!]
"""
List of images on which the argument image depends on
"""
BaseImageList(image: String!): [ImageSummary!]
"""
Search for a specific image using its name
"""
Image(image: String!): ImageSummary
"""
Returns a list of descriptors of an image or artifact manifest that are found in a <repo> and have a subject field of <digest>
Can be filtered based on a specific artifact type <type>
"""
Referrers(repo: String!, digest: String!, type: String!): [Referrer]!
}