mirror of
https://github.com/project-zot/zot.git
synced 2024-12-30 22:34:13 -05:00
use zot as an extension name, ext as a component and search as a module
add endpoints field in ext discover api distribution spec extension discover api has endpoints field required. https://github.com/opencontainers/distribution-spec/blob/main/extensions/_oci.md#extensions-property-descriptions Signed-off-by: Shivam Mishra <shimish2@cisco.com>
This commit is contained in:
parent
5e22acbbc4
commit
dcdeb935fd
5 changed files with 28 additions and 17 deletions
|
@ -5,5 +5,5 @@ const (
|
||||||
ExtCatalogPrefix = "/_catalog"
|
ExtCatalogPrefix = "/_catalog"
|
||||||
ExtOciDiscoverPrefix = "/_oci/ext/discover"
|
ExtOciDiscoverPrefix = "/_oci/ext/discover"
|
||||||
// zot specific extensions.
|
// zot specific extensions.
|
||||||
ExtSearchPrefix = RoutePrefix + "/_search"
|
ExtSearchPrefix = RoutePrefix + "/_zot/ext/search"
|
||||||
)
|
)
|
||||||
|
|
|
@ -4854,6 +4854,11 @@ func TestDistSpecExtensions(t *testing.T) {
|
||||||
err = json.Unmarshal(resp.Body(), &extensionList)
|
err = json.Unmarshal(resp.Body(), &extensionList)
|
||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
So(len(extensionList.Extensions), ShouldEqual, 1)
|
So(len(extensionList.Extensions), ShouldEqual, 1)
|
||||||
|
So(len(extensionList.Extensions[0].Endpoints), ShouldEqual, 1)
|
||||||
|
So(extensionList.Extensions[0].Name, ShouldEqual, "zot")
|
||||||
|
So(extensionList.Extensions[0].URL, ShouldContainSubstring, "_zot.md")
|
||||||
|
So(extensionList.Extensions[0].Description, ShouldNotBeEmpty)
|
||||||
|
So(extensionList.Extensions[0].Endpoints[0], ShouldEqual, constants.RoutePrefix+constants.ExtSearchPrefix)
|
||||||
})
|
})
|
||||||
|
|
||||||
Convey("start minimal zot server", t, func(c C) {
|
Convey("start minimal zot server", t, func(c C) {
|
||||||
|
|
12
pkg/extensions/_zot.md
Normal file
12
pkg/extensions/_zot.md
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
`zot` [extension](#references)
|
||||||
|
===
|
||||||
|
|
||||||
|
`zot` extension has following components accessible under `/v2/_zot` endpoint.
|
||||||
|
|
||||||
|
Component | Endpoint | Description
|
||||||
|
--- | --- | ---
|
||||||
|
[`search`](search/search.md) | `/v2/_zot/ext/search` | efficient and enhanced registry search capabilities using graphQL backend
|
||||||
|
|
||||||
|
|
||||||
|
# References
|
||||||
|
[1] https://github.com/opencontainers/distribution-spec/tree/main/extensions
|
|
@ -112,11 +112,12 @@ func EnableScrubExtension(config *config.Config, storeController storage.StoreCo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getExtension(name, url, description string) distext.Extension {
|
func getExtension(name, url, description string, endpoints []string) distext.Extension {
|
||||||
return distext.Extension{
|
return distext.Extension{
|
||||||
Name: name,
|
Name: name,
|
||||||
URL: url,
|
URL: url,
|
||||||
Description: description,
|
Description: description,
|
||||||
|
Endpoints: endpoints,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,9 +127,10 @@ func GetExtensions(config *config.Config) distext.ExtensionList {
|
||||||
extensions := make([]distext.Extension, 0)
|
extensions := make([]distext.Extension, 0)
|
||||||
|
|
||||||
if config.Extensions != nil && config.Extensions.Search != nil {
|
if config.Extensions != nil && config.Extensions.Search != nil {
|
||||||
searchExt := getExtension("search",
|
endpoints := []string{fmt.Sprintf("%s%s", constants.RoutePrefix, constants.ExtSearchPrefix)}
|
||||||
"https://github.com/project-zot/zot/tree/main/pkg/extensions/search/_search.md",
|
searchExt := getExtension("zot",
|
||||||
"search extension to provide various search feature e.g cve")
|
"https://github.com/project-zot/zot/tree/main/pkg/extensions/_zot.md",
|
||||||
|
"zot extension provide various components e.g search that provides various search capabilities", endpoints)
|
||||||
|
|
||||||
extensions = append(extensions, searchExt)
|
extensions = append(extensions, searchExt)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
`search` extension
|
# `search`
|
||||||
===
|
|
||||||
|
|
||||||
`search` extension provides efficient and enhanced registry search capabilities using graphQL backend.
|
|
||||||
|
|
||||||
|
|
||||||
Table of Contents
|
|
||||||
===
|
|
||||||
|
|
||||||
|
`search` component provides efficient and enhanced registry search capabilities using graphQL backend.
|
||||||
|
|
||||||
| Supported queries | Input | Ouput | Description | graphQL query |
|
| Supported queries | Input | Ouput | Description | graphQL query |
|
||||||
| --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- |
|
||||||
| [Search images by digest](#search-images-by-digest) | digest | image list | Search all repositories in the registry and return list of images that matches given digest (manifest, config or layers) | ImageListForDigest |
|
| [Search images by digest](#search-images-by-digest) | digest | image list | Search all repositories in the registry and return list of images that matches given digest (manifest, config or layers) | ImageListForDigest |
|
||||||
|
@ -92,7 +87,7 @@ curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ CVEListFo
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
# List images not affected by a given CVE id
|
# List images not affected by a given CVE id
|
||||||
|
|
||||||
|
@ -189,6 +184,3 @@ curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ ExpandedR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
# References
|
|
||||||
[1] https://github.com/opencontainers/distribution-spec/tree/main/extensions
|
|
Loading…
Reference in a new issue