mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 04:48:26 +08:00
Signed-off-by: Lisca Ana-Roberta <ana.kagome@yahoo.com> (#713)
list all images that have are base images for the given image + zli command Signed-off-by: Lisca Ana-Roberta <ana.kagome@yahoo.com>
This commit is contained in:
committed by
GitHub
parent
944ae66844
commit
0f7b174fc0
@@ -34,6 +34,8 @@ type SearchService interface {
|
||||
cveID string) (*imagesForCve, error)
|
||||
getFixedTagsForCVEGQL(ctx context.Context, config searchConfig, username, password, imageName,
|
||||
cveID string) (*fixedTags, error)
|
||||
getDerivedImageListGQL(ctx context.Context, config searchConfig, username, password string,
|
||||
derivedImage string) (*imageListStructForDerivedImagesGQL, error)
|
||||
getBaseImageListGQL(ctx context.Context, config searchConfig, username, password string,
|
||||
baseImage string) (*imageListStructForBaseImagesGQL, error)
|
||||
|
||||
@@ -61,6 +63,32 @@ func NewSearchService() SearchService {
|
||||
return searchService{}
|
||||
}
|
||||
|
||||
func (service searchService) getDerivedImageListGQL(ctx context.Context, config searchConfig, username, password string,
|
||||
derivedImage string,
|
||||
) (*imageListStructForDerivedImagesGQL, error) {
|
||||
query := fmt.Sprintf(`
|
||||
{
|
||||
DerivedImageList(image:"%s"){
|
||||
RepoName,
|
||||
Tag,
|
||||
Digest,
|
||||
ConfigDigest,
|
||||
LastUpdated,
|
||||
IsSigned,
|
||||
Size
|
||||
}
|
||||
}`, derivedImage)
|
||||
|
||||
result := &imageListStructForDerivedImagesGQL{}
|
||||
err := service.makeGraphQLQuery(ctx, config, username, password, query, result)
|
||||
|
||||
if errResult := checkResultGraphQLQuery(ctx, err, result.Errors); errResult != nil {
|
||||
return nil, errResult
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (service searchService) getBaseImageListGQL(ctx context.Context, config searchConfig, username, password string,
|
||||
baseImage string,
|
||||
) (*imageListStructForBaseImagesGQL, error) {
|
||||
@@ -831,6 +859,13 @@ type imageListStructForDigestGQL struct {
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
type imageListStructForDerivedImagesGQL struct {
|
||||
Errors []errorGraphQL `json:"errors"`
|
||||
Data struct {
|
||||
ImageList []imageStruct `json:"DerivedImageList"` // nolint:tagliatelle
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
type imageListStructForBaseImagesGQL struct {
|
||||
Errors []errorGraphQL `json:"errors"`
|
||||
Data struct {
|
||||
|
||||
Reference in New Issue
Block a user