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 ociManifestMediaType = "application/vnd.oci.image.manifest.v1+json"
|
||||||
let ociConfigMediaType = "application/vnd.oci.image.config.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
|
// Layer media types
|
||||||
let configMediaType = "application/vnd.cirruslabs.tart.config.v1"
|
let configMediaType = "application/vnd.cirruslabs.tart.config.v1"
|
||||||
let diskV2MediaType = "application/vnd.cirruslabs.tart.disk.v2"
|
let diskV2MediaType = "application/vnd.cirruslabs.tart.disk.v2"
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ extension OCIArchiveWriter: BlobStorage {
|
||||||
var manifests: [[String: Any]] = []
|
var manifests: [[String: Any]] = []
|
||||||
|
|
||||||
let baseDescriptor: [String: Any] = [
|
let baseDescriptor: [String: Any] = [
|
||||||
"mediaType": ociManifestMediaType,
|
"mediaType": dockerManifestMediaType,
|
||||||
"digest": manifestDigest,
|
"digest": manifestDigest,
|
||||||
"size": manifestSize,
|
"size": manifestSize,
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -29,12 +29,17 @@ extension VMDirectory {
|
||||||
let ociConfigContainer = OCIConfig.ConfigContainer(Labels: labels)
|
let ociConfigContainer = OCIConfig.ConfigContainer(Labels: labels)
|
||||||
let ociConfigJSON = try OCIConfig(architecture: config.arch, os: config.os, config: ociConfigContainer).toJSON()
|
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 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,
|
layers: layers,
|
||||||
uncompressedDiskSize: UInt64(diskSize),
|
uncompressedDiskSize: UInt64(diskSize),
|
||||||
uploadDate: Date()
|
uploadDate: Date()
|
||||||
)
|
)
|
||||||
|
manifest.mediaType = dockerManifestMediaType
|
||||||
|
|
||||||
let tagRef = tag ?? "latest"
|
let tagRef = tag ?? "latest"
|
||||||
defaultLogger.appendNewLine("saving manifest...")
|
defaultLogger.appendNewLine("saving manifest...")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue