Skip to content

Commit 555790e

Browse files
committed
ostree: support v1 manifests
system containers used to support this format. Let's include it, since the required changes are minimal. Signed-off-by: Giuseppe Scrivano <[email protected]>
1 parent 48c1877 commit 555790e

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

ostree/ostree_dest.go

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,13 @@ type descriptor struct {
4848
Digest digest.Digest `json:"digest"`
4949
}
5050

51+
type fsLayersSchema1 struct {
52+
BlobSum digest.Digest `json:"blobSum"`
53+
}
54+
5155
type manifestSchema struct {
52-
ConfigDescriptor descriptor `json:"config"`
53-
LayersDescriptors []descriptor `json:"layers"`
56+
LayersDescriptors []descriptor `json:"layers"`
57+
FSLayers []fsLayersSchema1 `json:"fsLayers"`
5458
}
5559

5660
type ostreeImageDestination struct {
@@ -346,20 +350,32 @@ func (d *ostreeImageDestination) Commit() error {
346350
return err
347351
}
348352

349-
for _, layer := range d.schema.LayersDescriptors {
350-
hash := layer.Digest.Hex()
353+
checkLayer := func(hash string) error {
351354
blob := d.blobs[hash]
352355
// if the blob is not present in d.blobs then it is already stored in OSTree,
353356
// and we don't need to import it.
354357
if blob == nil {
355-
continue
358+
return nil
356359
}
357360
err := d.importBlob(repo, blob)
358361
if err != nil {
359362
return err
360363
}
361364

362365
delete(d.blobs, hash)
366+
return nil
367+
}
368+
for _, layer := range d.schema.LayersDescriptors {
369+
hash := layer.Digest.Hex()
370+
if err = checkLayer(hash); err != nil {
371+
return err
372+
}
373+
}
374+
for _, layer := range d.schema.FSLayers {
375+
hash := layer.BlobSum.Hex()
376+
if err = checkLayer(hash); err != nil {
377+
return err
378+
}
363379
}
364380

365381
// Import the other blobs that are not layers

0 commit comments

Comments
 (0)