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:
LaurentiuNiculae
2023-05-12 19:32:01 +03:00
committed by GitHub
parent d17fe0044b
commit 7d7bc9d5e4
20 changed files with 201 additions and 155 deletions
+3 -3
View File
@@ -180,7 +180,7 @@ func (sig *signaturesCopier) syncCosignSignature(localRepo, remoteRepo, digestSt
}
// push manifest
_, err = imageStore.PutImageManifest(localRepo, cosignTag,
_, _, err = imageStore.PutImageManifest(localRepo, cosignTag,
ispec.MediaTypeImageManifest, cosignManifestBuf)
if err != nil {
sig.log.Error().Str("errorType", common.TypeOf(err)).
@@ -258,7 +258,7 @@ func (sig *signaturesCopier) syncORASRefs(localRepo, remoteRepo, digestStr strin
}
}
_, err = imageStore.PutImageManifest(localRepo, ref.Digest.String(),
_, _, err = imageStore.PutImageManifest(localRepo, ref.Digest.String(),
oras.MediaTypeArtifactManifest, body)
if err != nil {
sig.log.Error().Str("errorType", common.TypeOf(err)).
@@ -359,7 +359,7 @@ func (sig *signaturesCopier) syncOCIRefs(localRepo, remoteRepo, digestStr string
continue
}
digest, err := imageStore.PutImageManifest(localRepo, ref.Digest.String(),
digest, _, err := imageStore.PutImageManifest(localRepo, ref.Digest.String(),
ref.MediaType, OCIRefBody)
if err != nil {
sig.log.Error().Str("errorType", common.TypeOf(err)).
+2 -2
View File
@@ -698,7 +698,7 @@ func TestSyncInternal(t *testing.T) {
manifestDigest := godigest.FromBytes(manifestContent)
_, err = testImageStore.PutImageManifest(repo, manifestDigest.String(),
_, _, err = testImageStore.PutImageManifest(repo, manifestDigest.String(),
ispec.MediaTypeImageManifest, manifestContent)
So(err, ShouldBeNil)
@@ -715,7 +715,7 @@ func TestSyncInternal(t *testing.T) {
So(digest, ShouldNotBeNil)
// upload index image
_, err = testImageStore.PutImageManifest(repo, "latest", ispec.MediaTypeImageIndex, content)
_, _, err = testImageStore.PutImageManifest(repo, "latest", ispec.MediaTypeImageIndex, content)
So(err, ShouldBeNil)
err = pushSyncedLocalImage(repo, "latest", testRootDir, nil, imageStore, log)
+2 -2
View File
@@ -337,7 +337,7 @@ func pushSyncedLocalImage(localRepo, reference, localCachePath string,
}
}
_, err = imageStore.PutImageManifest(localRepo, reference, mediaType, manifestBlob)
_, _, err = imageStore.PutImageManifest(localRepo, reference, mediaType, manifestBlob)
if err != nil {
log.Error().Str("errorType", common.TypeOf(err)).
Err(err).Msg("couldn't upload manifest")
@@ -393,7 +393,7 @@ func copyManifest(localRepo string, manifestContent []byte, reference string, re
return err
}
digest, err := imageStore.PutImageManifest(localRepo, reference,
digest, _, err := imageStore.PutImageManifest(localRepo, reference,
ispec.MediaTypeImageManifest, manifestContent)
if err != nil {
log.Error().Str("errorType", common.TypeOf(err)).