mirror of https://github.com/cirruslabs/tart.git
fix(save): use Docker v2s2 manifest format for skopeo compatibility
This commit is contained in:
parent
b5253d5e89
commit
6231f95021
|
|
@ -4,6 +4,10 @@ import Foundation
|
|||
let ociManifestMediaType = "application/vnd.oci.image.manifest.v1+json"
|
||||
let ociConfigMediaType = "application/vnd.oci.image.config.v1+json"
|
||||
|
||||
// Docker manifest and config media types (schema v2)
|
||||
let dockerManifestMediaType = "application/vnd.docker.distribution.manifest.v2+json"
|
||||
let dockerConfigMediaType = "application/vnd.docker.container.image.v1+json"
|
||||
|
||||
// Layer media types
|
||||
let configMediaType = "application/vnd.cirruslabs.tart.config.v1"
|
||||
let diskV2MediaType = "application/vnd.cirruslabs.tart.disk.v2"
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ extension OCIArchiveWriter: BlobStorage {
|
|||
var manifests: [[String: Any]] = []
|
||||
|
||||
let baseDescriptor: [String: Any] = [
|
||||
"mediaType": ociManifestMediaType,
|
||||
"mediaType": dockerManifestMediaType,
|
||||
"digest": manifestDigest,
|
||||
"size": manifestSize,
|
||||
]
|
||||
|
|
|
|||
|
|
@ -29,12 +29,17 @@ extension VMDirectory {
|
|||
let ociConfigContainer = OCIConfig.ConfigContainer(Labels: labels)
|
||||
let ociConfigJSON = try OCIConfig(architecture: config.arch, os: config.os, config: ociConfigContainer).toJSON()
|
||||
let ociConfigDigest = try await archive.pushBlob(fromData: ociConfigJSON, chunkSizeMb: 0, digest: nil)
|
||||
let manifest = OCIManifest(
|
||||
config: OCIManifestConfig(size: ociConfigJSON.count, digest: ociConfigDigest),
|
||||
|
||||
var manifestConfig = OCIManifestConfig(size: ociConfigJSON.count, digest: ociConfigDigest)
|
||||
manifestConfig.mediaType = dockerConfigMediaType
|
||||
|
||||
var manifest = OCIManifest(
|
||||
config: manifestConfig,
|
||||
layers: layers,
|
||||
uncompressedDiskSize: UInt64(diskSize),
|
||||
uploadDate: Date()
|
||||
)
|
||||
manifest.mediaType = dockerManifestMediaType
|
||||
|
||||
let tagRef = tag ?? "latest"
|
||||
defaultLogger.appendNewLine("saving manifest...")
|
||||
|
|
|
|||
Loading…
Reference in New Issue