mirror of
https://github.com/project-zot/zot.git
synced 2026-06-20 06:37:56 +08:00
feat(sync): use regclient for sync extension (#2903)
* feat(sync): use regclient for sync extension replaced containers/image package with regclient/regclient package Signed-off-by: Eusebiu Petu <petu.eusebiu@gmail.com> * fix(sync): fixed converting innner docker list mediatype Signed-off-by: Eusebiu Petu <petu.eusebiu@gmail.com> * feat(sync): added option to preserve digest Signed-off-by: Eusebiu Petu <petu.eusebiu@gmail.com> * fix(sync): added coverage and various fixes Signed-off-by: Eusebiu Petu <petu.eusebiu@gmail.com> * fix(metadb): fixed converting manifest list not setting platform and annotations Signed-off-by: Eusebiu Petu <petu.eusebiu@gmail.com> * fix(sync): remove read lock on storage, not used concurrently Signed-off-by: Eusebiu Petu <petu.eusebiu@gmail.com> * feat(sync): added cache for repo tags Signed-off-by: Eusebiu Petu <petu.eusebiu@gmail.com> * fix(sync): fixed Makefile removed opengpg tag Signed-off-by: Eusebiu Petu <petu.eusebiu@gmail.com> * fix(sync): add test for on demand referrer Signed-off-by: Eusebiu Petu <petu.eusebiu@gmail.com> --------- Signed-off-by: Eusebiu Petu <petu.eusebiu@gmail.com>
This commit is contained in:
+24
-9
@@ -34,6 +34,12 @@ func MakeAuthTestServer(serverKey, signAlg string, unauthorizedNamespace string)
|
||||
signingMethod := jwt.GetSigningMethod(signAlg)
|
||||
|
||||
authTestServer := httptest.NewServer(http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) {
|
||||
if request.Method != http.MethodGet {
|
||||
response.WriteHeader(http.StatusMethodNotAllowed)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
var access []api.ResourceAccess
|
||||
|
||||
scope := request.URL.Query().Get("scope")
|
||||
@@ -94,10 +100,21 @@ func MakeAuthTestServerLegacy(serverKey string, unauthorizedNamespace string) *h
|
||||
}
|
||||
|
||||
authTestServer := httptest.NewServer(http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) {
|
||||
if request.Method != http.MethodGet {
|
||||
response.WriteHeader(http.StatusMethodNotAllowed)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
var access []auth.AccessEntry
|
||||
|
||||
scope := request.URL.Query().Get("scope")
|
||||
if scope != "" {
|
||||
scopes := request.URL.Query()["scope"]
|
||||
|
||||
for _, scope := range scopes {
|
||||
if scope == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
parts := strings.Split(scope, ":")
|
||||
name := parts[1]
|
||||
actions := strings.Split(parts[2], ",")
|
||||
@@ -106,13 +123,11 @@ func MakeAuthTestServerLegacy(serverKey string, unauthorizedNamespace string) *h
|
||||
actions = []string{}
|
||||
}
|
||||
|
||||
access = []auth.AccessEntry{
|
||||
{
|
||||
Name: name,
|
||||
Type: "repository",
|
||||
Actions: actions,
|
||||
},
|
||||
}
|
||||
access = append(access, auth.AccessEntry{
|
||||
Name: name,
|
||||
Type: "repository",
|
||||
Actions: actions,
|
||||
})
|
||||
}
|
||||
|
||||
token, err := cmTokenGenerator.GenerateToken(access, time.Minute*1)
|
||||
|
||||
Reference in New Issue
Block a user