0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-23 22:27:35 -05:00
zot/pkg/extensions/search/schema.graphql
Andrei Aaron feb7328f50
feat(repodb): DerivedImageList and BaseImageList make use of RepoDB (#1135)
- derivedImageList and baseImageList now use FilterTags to obtain results,
each with its own filter function
- images that have the exact same manifest as the one provided as a
parameter are no longer considered base images or derived images
- both calls can be made with specific pagination parameters, and the
response will include PageInfo

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

fix(tests): fix one of the pagination tests

The results were not reliable as the 2 returned tags were sorted by created date/time
which was not set, resulting in an unpredictable order

Signed-off-by: Andrei Aaron <andaaron@cisco.com>
(cherry picked from commit be504200a1127371422aeb0e5c0219e2a1ead20a)
(cherry picked from commit ed8d797e639f262a63840120afe92da7db9a7600)
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

Signed-off-by: Andrei Aaron <andaaron@cisco.com>
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
Co-authored-by: Alex Stan <alexandrustan96@yahoo.ro>
2023-01-25 14:06:02 -08:00

264 lines
6.1 KiB
GraphQL

scalar Time
"""
Contains the tag of the image and a list of CVEs
"""
type CVEResultForImage {
Tag: String
CVEList: [CVE]
Page: PageInfo
}
"""
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
SEVERITY
STARS
DOWNLOADS
}
type PageInfo {
TotalCount: Int!
ItemCount: Int!
}
# Pagination parameters
input PageInput {
limit: Int
offset: Int
sortBy: SortCriteria
}
# Paginated list of RepoSummary objects
# If limit is -1, pagination is disabled
type PaginatedReposResult {
Page: PageInfo
Results: [RepoSummary!]!
}
# Paginated list of ImageSummary objects
# If limit is -1, pagination is disabled
type PaginatedImagesResult {
Page: PageInfo
Results: [ImageSummary!]!
}
input Filter {
Os: [String]
Arch: [String]
HasToBeSigned: Boolean
}
type Query {
"""
Returns a CVE list for the image specified in the argument. Format image:tag
"""
CVEListForImage(image: String!, requestedPage: PageInput): CVEResultForImage!
"""
Returns a list of images vulnerable to the CVE of the specified ID
"""
ImageListForCVE(id: String!, requestedPage: PageInput): [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!, requestedPage: PageInput): [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): PaginatedReposResult! # Newest based on created timestamp
"""
Returns all the images from the specified repo | from all repos if specified repo is ""
"""
ImageList(repo: String!, requestedPage: PageInput): [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!, requestedPage: PageInput): PaginatedImagesResult!
"""
List of images on which the argument image depends on
"""
BaseImageList(image: String!, requestedPage: PageInput): PaginatedImagesResult!
"""
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]!
}