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>
This commit is contained in:
Andrei Aaron
2023-01-26 00:06:02 +02:00
committed by GitHub
parent be4b8c6243
commit feb7328f50
15 changed files with 1525 additions and 482 deletions
+29 -18
View File
@@ -71,14 +71,16 @@ func (service searchService) getDerivedImageListGQL(ctx context.Context, config
query := fmt.Sprintf(`
{
DerivedImageList(image:"%s"){
RepoName,
Tag,
Digest,
ConfigDigest,
Layers {Size Digest},
LastUpdated,
IsSigned,
Size
Results{
RepoName,
Tag,
Digest,
ConfigDigest,
Layers {Size Digest},
LastUpdated,
IsSigned,
Size
}
}
}`, derivedImage)
@@ -98,14 +100,16 @@ func (service searchService) getBaseImageListGQL(ctx context.Context, config sea
query := fmt.Sprintf(`
{
BaseImageList(image:"%s"){
RepoName,
Tag,
Digest,
ConfigDigest,
Layers {Size Digest},
LastUpdated,
IsSigned,
Size
Results{
RepoName,
Tag,
Digest,
ConfigDigest,
Layers {Size Digest},
LastUpdated,
IsSigned,
Size
}
}
}`, baseImage)
@@ -862,6 +866,13 @@ type imageStruct struct {
IsSigned bool `json:"isSigned"`
}
type DerivedImageList struct {
Results []imageStruct `json:"results"`
}
type BaseImageList struct {
Results []imageStruct `json:"results"`
}
type imageListStructGQL struct {
Errors []errorGraphQL `json:"errors"`
Data struct {
@@ -879,14 +890,14 @@ type imageListStructForDigestGQL struct {
type imageListStructForDerivedImagesGQL struct {
Errors []errorGraphQL `json:"errors"`
Data struct {
ImageList []imageStruct `json:"DerivedImageList"` //nolint:tagliatelle
ImageList DerivedImageList `json:"DerivedImageList"` //nolint:tagliatelle
} `json:"data"`
}
type imageListStructForBaseImagesGQL struct {
Errors []errorGraphQL `json:"errors"`
Data struct {
ImageList []imageStruct `json:"BaseImageList"` //nolint:tagliatelle
ImageList BaseImageList `json:"BaseImageList"` //nolint:tagliatelle
} `json:"data"`
}