mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
feat(api): added oci-subject header when pushing an image with subject field (#1415)
- as requested by the latest version of the oci distribution spec Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
This commit is contained in:
+2
-2
@@ -346,7 +346,7 @@ func WriteImageToFileSystem(image Image, repoName string, storeController storag
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = store.PutImageManifest(repoName, image.Reference, ispec.MediaTypeImageManifest, manifestBlob)
|
||||
_, _, err = store.PutImageManifest(repoName, image.Reference, ispec.MediaTypeImageManifest, manifestBlob)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -376,7 +376,7 @@ func WriteMultiArchImageToFileSystem(multiarchImage MultiarchImage, repoName str
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = store.PutImageManifest(repoName, multiarchImage.Reference, ispec.MediaTypeImageIndex,
|
||||
_, _, err = store.PutImageManifest(repoName, multiarchImage.Reference, ispec.MediaTypeImageIndex,
|
||||
indexBlob)
|
||||
|
||||
return err
|
||||
|
||||
@@ -1349,8 +1349,8 @@ func TestWriteImageToFileSystem(t *testing.T) {
|
||||
storage.StoreController{
|
||||
DefaultStore: mocks.MockedImageStore{
|
||||
PutImageManifestFn: func(repo, reference, mediaType string, body []byte,
|
||||
) (godigest.Digest, error) {
|
||||
return "", ErrTestError
|
||||
) (godigest.Digest, godigest.Digest, error) {
|
||||
return "", "", ErrTestError
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -12,15 +12,16 @@ import (
|
||||
)
|
||||
|
||||
type MockedImageStore struct {
|
||||
DirExistsFn func(d string) bool
|
||||
RootDirFn func() string
|
||||
InitRepoFn func(name string) error
|
||||
ValidateRepoFn func(name string) (bool, error)
|
||||
GetRepositoriesFn func() ([]string, error)
|
||||
GetNextRepositoryFn func(repo string) (string, error)
|
||||
GetImageTagsFn func(repo string) ([]string, error)
|
||||
GetImageManifestFn func(repo string, reference string) ([]byte, godigest.Digest, string, error)
|
||||
PutImageManifestFn func(repo string, reference string, mediaType string, body []byte) (godigest.Digest, error)
|
||||
DirExistsFn func(d string) bool
|
||||
RootDirFn func() string
|
||||
InitRepoFn func(name string) error
|
||||
ValidateRepoFn func(name string) (bool, error)
|
||||
GetRepositoriesFn func() ([]string, error)
|
||||
GetNextRepositoryFn func(repo string) (string, error)
|
||||
GetImageTagsFn func(repo string) ([]string, error)
|
||||
GetImageManifestFn func(repo string, reference string) ([]byte, godigest.Digest, string, error)
|
||||
PutImageManifestFn func(repo string, reference string, mediaType string, body []byte) (godigest.Digest,
|
||||
godigest.Digest, error)
|
||||
DeleteImageManifestFn func(repo string, reference string, detectCollision bool) error
|
||||
BlobUploadPathFn func(repo string, uuid string) string
|
||||
NewBlobUploadFn func(repo string) (string, error)
|
||||
@@ -124,12 +125,12 @@ func (is MockedImageStore) PutImageManifest(
|
||||
reference string,
|
||||
mediaType string,
|
||||
body []byte,
|
||||
) (godigest.Digest, error) {
|
||||
) (godigest.Digest, godigest.Digest, error) {
|
||||
if is.PutImageManifestFn != nil {
|
||||
return is.PutImageManifestFn(repo, reference, mediaType, body)
|
||||
}
|
||||
|
||||
return "", nil
|
||||
return "", "", nil
|
||||
}
|
||||
|
||||
func (is MockedImageStore) GetImageTags(name string) ([]string, error) {
|
||||
|
||||
Reference in New Issue
Block a user