mirror of
https://github.com/apple/container.git
synced 2026-09-24 23:29:51 -05:00
Update to containerization 0.42.0 (#2207)
Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
This commit is contained in:
+3
-3
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"originHash" : "35d1f07a3595a3ebabac1430f46ebb8b4e54d4531874f4ff7df33b64092df5f3",
|
||||
"originHash" : "277d874bbc7e5360092b7cd5caefe5759a7f246908ee9b2bd13b854792e67a7f",
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "async-http-client",
|
||||
@@ -15,8 +15,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/containerization.git",
|
||||
"state" : {
|
||||
"revision" : "5427fd21ded4b84034126caef5b3182900b4776d",
|
||||
"version" : "0.41.0"
|
||||
"revision" : "c0185aea5c04fcd4d1cfe9359e0066a380835403",
|
||||
"version" : "0.42.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import PackageDescription
|
||||
let releaseVersion = ProcessInfo.processInfo.environment["RELEASE_VERSION"] ?? "0.0.0"
|
||||
let gitCommit = ProcessInfo.processInfo.environment["GIT_COMMIT"] ?? "unspecified"
|
||||
let builderShimVersion = "0.13.1"
|
||||
let scVersion = "0.41.0"
|
||||
let scVersion = "0.42.0"
|
||||
|
||||
let package = Package(
|
||||
name: "container",
|
||||
|
||||
@@ -302,7 +302,7 @@ public actor ImagesService {
|
||||
for image in images {
|
||||
guard activeReferences.contains(image.reference) else { continue }
|
||||
activeCount += 1
|
||||
let imageDigest = image.digest.trimmingDigestPrefix
|
||||
let imageDigest = try image.digest.validatedDigestEncoding()
|
||||
guard processedDigests.insert(imageDigest).inserted else { continue }
|
||||
|
||||
for digest in try await image.referencedDigests() where activeContentSizes[digest] == nil {
|
||||
|
||||
@@ -80,7 +80,7 @@ public actor SnapshotStore {
|
||||
|
||||
for desc in toUnpack {
|
||||
try Task.checkCancellation()
|
||||
let snapshotDir = self.snapshotDir(desc)
|
||||
let snapshotDir = try self.snapshotDir(desc)
|
||||
guard !self.fm.fileExists(atPath: snapshotDir.absolutePath()) else {
|
||||
// We have already unpacked this image + platform. Skip
|
||||
continue
|
||||
@@ -110,7 +110,7 @@ public actor SnapshotStore {
|
||||
let mount = try await unpacker.unpack(image, for: platform, at: tempSnapshotPath, progress: progress)
|
||||
let fs = Filesystem.block(
|
||||
format: mount.type,
|
||||
source: self.snapshotPath(desc).absolutePath(),
|
||||
source: try self.snapshotPath(desc).absolutePath(),
|
||||
destination: mount.destination,
|
||||
options: mount.options
|
||||
)
|
||||
@@ -141,7 +141,7 @@ public actor SnapshotStore {
|
||||
toDelete = try await image.unpackableDescriptors()
|
||||
}
|
||||
for desc in toDelete {
|
||||
let p = self.snapshotDir(desc)
|
||||
let p = try self.snapshotDir(desc)
|
||||
guard self.fm.fileExists(atPath: p.absolutePath()) else {
|
||||
continue
|
||||
}
|
||||
@@ -151,8 +151,8 @@ public actor SnapshotStore {
|
||||
|
||||
public func get(for image: Containerization.Image, platform: Platform) async throws -> Filesystem {
|
||||
let desc = try await image.descriptor(for: platform)
|
||||
let infoPath = snapshotInfoPath(desc)
|
||||
let fsPath = snapshotPath(desc)
|
||||
let infoPath = try snapshotInfoPath(desc)
|
||||
let fsPath = try snapshotPath(desc)
|
||||
|
||||
guard self.fm.fileExists(atPath: infoPath.absolutePath()),
|
||||
self.fm.fileExists(atPath: fsPath.absolutePath())
|
||||
@@ -173,7 +173,7 @@ public actor SnapshotStore {
|
||||
continue
|
||||
}
|
||||
let desc = try await image.descriptor(for: platform)
|
||||
toKeep.append(desc.digest.trimmingDigestPrefix)
|
||||
toKeep.append(try desc.digest.validatedDigestEncoding())
|
||||
}
|
||||
}
|
||||
let all = try self.fm.contentsOfDirectory(at: self.path, includingPropertiesForKeys: [.totalFileAllocatedSizeKey]).map {
|
||||
@@ -192,19 +192,19 @@ public actor SnapshotStore {
|
||||
return deletedBytes
|
||||
}
|
||||
|
||||
private func snapshotDir(_ desc: Descriptor) -> URL {
|
||||
let p = self.path.appendingPathComponent(desc.digest.trimmingDigestPrefix, isDirectory: true)
|
||||
private func snapshotDir(_ desc: Descriptor) throws -> URL {
|
||||
let p = self.path.appendingPathComponent(try desc.digest.validatedDigestEncoding(), isDirectory: true)
|
||||
return p
|
||||
}
|
||||
|
||||
private func snapshotPath(_ desc: Descriptor) -> URL {
|
||||
let p = self.snapshotDir(desc)
|
||||
private func snapshotPath(_ desc: Descriptor) throws -> URL {
|
||||
let p = try self.snapshotDir(desc)
|
||||
.appendingPathComponent(Self.snapshotFileName, isDirectory: false)
|
||||
return p
|
||||
}
|
||||
|
||||
private func snapshotInfoPath(_ desc: Descriptor) -> URL {
|
||||
let p = self.snapshotDir(desc)
|
||||
private func snapshotInfoPath(_ desc: Descriptor) throws -> URL {
|
||||
let p = try self.snapshotDir(desc)
|
||||
.appendingPathComponent(Self.snapshotInfoFileName, isDirectory: false)
|
||||
return p
|
||||
}
|
||||
@@ -216,8 +216,8 @@ public actor SnapshotStore {
|
||||
}
|
||||
|
||||
/// Get the disk size for a specific snapshot descriptor
|
||||
public func getSnapshotSize(descriptor: Descriptor) -> UInt64 {
|
||||
let snapshotPath = self.snapshotDir(descriptor)
|
||||
public func getSnapshotSize(descriptor: Descriptor) throws -> UInt64 {
|
||||
let snapshotPath = try self.snapshotDir(descriptor)
|
||||
guard self.fm.fileExists(atPath: snapshotPath.path) else {
|
||||
return 0
|
||||
}
|
||||
@@ -228,9 +228,9 @@ public actor SnapshotStore {
|
||||
public func getSnapshotSizes(for image: Containerization.Image) async throws -> [(digest: String, size: UInt64)] {
|
||||
var results: [(digest: String, size: UInt64)] = []
|
||||
for descriptor in try await image.unpackableDescriptors() {
|
||||
let size = self.getSnapshotSize(descriptor: descriptor)
|
||||
let size = try self.getSnapshotSize(descriptor: descriptor)
|
||||
guard size > 0 else { continue }
|
||||
results.append((descriptor.digest.trimmingDigestPrefix, size))
|
||||
results.append((try descriptor.digest.validatedDigestEncoding(), size))
|
||||
}
|
||||
return results
|
||||
}
|
||||
|
||||
@@ -44,13 +44,14 @@ private func makeSnapshot(
|
||||
} else {
|
||||
networksJSON = #"[{"network":"bridge","hostname":"\#(id)","ipv4Address":"\#(addr)/24","ipv4Gateway":"10.0.0.254"}]"#
|
||||
}
|
||||
let sha = "sha256:" + String(repeating: "a", count: 64)
|
||||
let json = """
|
||||
{
|
||||
"configuration": {
|
||||
"id": "\(id)",
|
||||
"image": {
|
||||
"reference": "docker.io/kindest/node:v1.35.5",
|
||||
"descriptor": {"mediaType":"","digest":"sha256:abc","size":0}
|
||||
"descriptor": {"mediaType":"","digest":"\(sha)","size":0}
|
||||
},
|
||||
"initProcess": {"executable":"/bin/sh","arguments":[],"environment":[],"workingDirectory":"/","terminal":false,"user":{"id":{"uid":0,"gid":0}},"supplementalGroups":[],"rlimits":[]},
|
||||
"resources": {"cpus":\(cpus),"memoryInBytes":\(memoryMiB * 1024 * 1024)},
|
||||
|
||||
Reference in New Issue
Block a user