mirror of
https://github.com/distribution/distribution.git
synced 2025-09-08 10:20:08 +00:00
Remove blobstore from manifest builder
Signed-off-by: glefloch <glfloch@gmail.com> Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
This commit is contained in:
committed by
David van der Spek
parent
4adbb690c1
commit
61e576f3d0
@@ -44,7 +44,7 @@ func MakeManifestList(blobstatter distribution.BlobStatter, manifestDigests []di
|
||||
//
|
||||
// Deprecated: Docker Image Manifest v2, Schema 1 is deprecated since 2015.
|
||||
// Use Docker Image Manifest v2, Schema 2, or the OCI Image Specification.
|
||||
func MakeSchema1Manifest(digests []digest.Digest) (distribution.Manifest, error) {
|
||||
func MakeSchema1Manifest(digests []digest.Digest) (*schema1.SignedManifest, error) {
|
||||
mfst := schema1.Manifest{
|
||||
Versioned: manifest.Versioned{
|
||||
SchemaVersion: 1,
|
||||
@@ -76,9 +76,16 @@ func MakeSchema1Manifest(digests []digest.Digest) (distribution.Manifest, error)
|
||||
func MakeSchema2Manifest(repository distribution.Repository, digests []digest.Digest) (distribution.Manifest, error) {
|
||||
ctx := context.Background()
|
||||
blobStore := repository.Blobs(ctx)
|
||||
builder := schema2.NewManifestBuilder(blobStore, schema2.MediaTypeImageConfig, []byte{})
|
||||
for _, d := range digests {
|
||||
builder.AppendReference(distribution.Descriptor{Digest: d})
|
||||
|
||||
var configJSON []byte
|
||||
|
||||
d, err := blobStore.Put(ctx, schema2.MediaTypeImageConfig, configJSON)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unexpected error storing content in blobstore %v", err)
|
||||
}
|
||||
builder := schema2.NewManifestBuilder(d, configJSON)
|
||||
for _, digest := range digests {
|
||||
builder.AppendReference(distribution.Descriptor{Digest: digest})
|
||||
}
|
||||
|
||||
mfst, err := builder.Build(ctx)
|
||||
|
Reference in New Issue
Block a user