From f07cc60cc13cd293b2be65e64499b503026aafce Mon Sep 17 00:00:00 2001 From: saehejkang Date: Thu, 5 Feb 2026 00:10:31 -0500 Subject: [PATCH 1/2] bump containaerization + update parameters for new functions --- Package.resolved | 6 +++--- Package.swift | 2 +- Sources/ContainerCommands/Registry/Login.swift | 6 +++--- Sources/ContainerCommands/Registry/Logout.swift | 4 ++-- .../ContainerImagesService/Server/ImageService.swift | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Package.resolved b/Package.resolved index 36c346441..615c17e87 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "77f4cb7cb202f3e17c1555bf456b949cdbe8ca07e268d02d39f02ec01a37042c", + "originHash" : "d795ef49c10b5084c12106f45c7da08aaf2a3d9355228499729eeb55501ee0ed", "pins" : [ { "identity" : "async-http-client", @@ -15,8 +15,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/containerization.git", "state" : { - "revision" : "c3fe889a2f739ee4a9b0faccedd9f36f3862dc29", - "version" : "0.24.5" + "revision" : "3f4eee7d2a4ae0d9587416f199e0b2edcf263a6f", + "version" : "0.25.0" } }, { diff --git a/Package.swift b/Package.swift index 014c92adf..f728e3754 100644 --- a/Package.swift +++ b/Package.swift @@ -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.7.0" -let scVersion = "0.24.5" +let scVersion = "0.25.0" let package = Package( name: "container", diff --git a/Sources/ContainerCommands/Registry/Login.swift b/Sources/ContainerCommands/Registry/Login.swift index 0c75fc1e8..b265ce4de 100644 --- a/Sources/ContainerCommands/Registry/Login.swift +++ b/Sources/ContainerCommands/Registry/Login.swift @@ -56,9 +56,9 @@ extension Application { } password = String(decoding: passwordData, as: UTF8.self).trimmingCharacters(in: .whitespacesAndNewlines) } - let keychain = KeychainHelper(id: Constants.keychainID) + let keychain = KeychainHelper(securityDomain: Constants.keychainID) if username == "" { - username = try keychain.userPrompt(domain: server) + username = try keychain.userPrompt(hostname: server) } if password == "" { password = try keychain.passwordPrompt() @@ -89,7 +89,7 @@ extension Application { ) ) try await client.ping() - try keychain.save(domain: server, username: username, password: password) + try keychain.save(hostname: server, username: username, password: password) print("Login succeeded") } } diff --git a/Sources/ContainerCommands/Registry/Logout.swift b/Sources/ContainerCommands/Registry/Logout.swift index 7f901db3a..e2cae4a77 100644 --- a/Sources/ContainerCommands/Registry/Logout.swift +++ b/Sources/ContainerCommands/Registry/Logout.swift @@ -32,9 +32,9 @@ extension Application { var registry: String public func run() async throws { - let keychain = KeychainHelper(id: Constants.keychainID) + let keychain = KeychainHelper(securityDomain: Constants.keychainID) let r = Reference.resolveDomain(domain: registry) - try keychain.delete(domain: r) + try keychain.delete(hostname: r) } } } diff --git a/Sources/Services/ContainerImagesService/Server/ImageService.swift b/Sources/Services/ContainerImagesService/Server/ImageService.swift index a172d0775..108ff5f86 100644 --- a/Sources/Services/ContainerImagesService/Server/ImageService.swift +++ b/Sources/Services/ContainerImagesService/Server/ImageService.swift @@ -223,9 +223,9 @@ extension ImagesService { if let authentication { return try await body(authentication) } - let keychain = KeychainHelper(id: Constants.keychainID) + let keychain = KeychainHelper(securityDomain: Constants.keychainID) do { - authentication = try keychain.lookup(domain: host) + authentication = try keychain.lookup(hostname: host) } catch let err as KeychainHelper.Error { guard case .keyNotFound = err else { throw ContainerizationError(.internalError, message: "error querying keychain for \(host)", cause: err) From 81ccaa119a262594d6debd76f9e3ebbf3c906cef Mon Sep 17 00:00:00 2001 From: Anthony DePasquale Date: Mon, 2 Feb 2026 21:50:33 +0000 Subject: [PATCH 2/2] Fix usage of "clean up" as verb Co-authored-by: Anthony DePasquale --- .../ContainerCommands/Image/ImageDelete.swift | 2 +- Sources/ContainerCommands/Image/ImagePrune.swift | 2 +- Sources/Helpers/Images/ImagesHelper.swift | 2 +- .../ContainerAPIService/Client/ClientImage.swift | 2 +- .../Server/Containers/ContainersService.swift | 12 ++++++------ .../Server/ImageService.swift | 4 ++-- .../Server/ImagesServiceHarness.swift | 4 ++-- .../Server/SandboxService.swift | 16 ++++++++-------- .../Volumes/TestCLIAnonymousVolumes.swift | 6 +++--- .../Subcommands/Volumes/TestCLIVolumes.swift | 10 +++++----- 10 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Sources/ContainerCommands/Image/ImageDelete.swift b/Sources/ContainerCommands/Image/ImageDelete.swift index 17afb23e3..c4e3f41f3 100644 --- a/Sources/ContainerCommands/Image/ImageDelete.swift +++ b/Sources/ContainerCommands/Image/ImageDelete.swift @@ -69,7 +69,7 @@ extension Application { failures.append(image.reference) } } - let (_, size) = try await ClientImage.cleanupOrphanedBlobs() + let (_, size) = try await ClientImage.cleanUpOrphanedBlobs() let formatter = ByteCountFormatter() let freed = formatter.string(fromByteCount: Int64(size)) diff --git a/Sources/ContainerCommands/Image/ImagePrune.swift b/Sources/ContainerCommands/Image/ImagePrune.swift index baf075940..12fa02134 100644 --- a/Sources/ContainerCommands/Image/ImagePrune.swift +++ b/Sources/ContainerCommands/Image/ImagePrune.swift @@ -65,7 +65,7 @@ extension Application { } } - let (deletedDigests, size) = try await ClientImage.cleanupOrphanedBlobs() + let (deletedDigests, size) = try await ClientImage.cleanUpOrphanedBlobs() for image in imagesToPrune { print("untagged \(image.reference)") diff --git a/Sources/Helpers/Images/ImagesHelper.swift b/Sources/Helpers/Images/ImagesHelper.swift index 03e446fd4..c3d98e187 100644 --- a/Sources/Helpers/Images/ImagesHelper.swift +++ b/Sources/Helpers/Images/ImagesHelper.swift @@ -96,7 +96,7 @@ extension ImagesHelper { routes[ImagesServiceXPCRoute.imageSave.rawValue] = harness.save routes[ImagesServiceXPCRoute.imageLoad.rawValue] = harness.load routes[ImagesServiceXPCRoute.imageUnpack.rawValue] = harness.unpack - routes[ImagesServiceXPCRoute.imageCleanupOrphanedBlobs.rawValue] = harness.cleanupOrphanedBlobs + routes[ImagesServiceXPCRoute.imageCleanupOrphanedBlobs.rawValue] = harness.cleanUpOrphanedBlobs routes[ImagesServiceXPCRoute.imageDiskUsage.rawValue] = harness.calculateDiskUsage routes[ImagesServiceXPCRoute.snapshotDelete.rawValue] = harness.deleteSnapshot routes[ImagesServiceXPCRoute.snapshotGet.rawValue] = harness.getSnapshot diff --git a/Sources/Services/ContainerAPIService/Client/ClientImage.swift b/Sources/Services/ContainerAPIService/Client/ClientImage.swift index 795e03890..42b242c8b 100644 --- a/Sources/Services/ContainerAPIService/Client/ClientImage.swift +++ b/Sources/Services/ContainerAPIService/Client/ClientImage.swift @@ -321,7 +321,7 @@ extension ClientImage { return ImageLoadResult(images: images, rejectedMembers: rejectedMembers) } - public static func cleanupOrphanedBlobs() async throws -> ([String], UInt64) { + public static func cleanUpOrphanedBlobs() async throws -> ([String], UInt64) { let client = newXPCClient() let request = newRequest(.imageCleanupOrphanedBlobs) let response = try await client.send(request) diff --git a/Sources/Services/ContainerAPIService/Server/Containers/ContainersService.swift b/Sources/Services/ContainerAPIService/Server/Containers/ContainersService.swift index 7eafb052c..c76e7d11c 100644 --- a/Sources/Services/ContainerAPIService/Server/Containers/ContainersService.swift +++ b/Sources/Services/ContainerAPIService/Server/Containers/ContainersService.swift @@ -493,7 +493,7 @@ public actor ContainersService { let client = try state.getClient() try await client.stop(options: opts) try await self.lock.withLock { context in - try await self.cleanup(id: id, context: context) + try await self.cleanUp(id: id, context: context) } case .stopping: throw ContainerizationError( @@ -502,7 +502,7 @@ public actor ContainersService { ) default: try await self.lock.withLock { context in - try await self.cleanup(id: id, context: context) + try await self.cleanUp(id: id, context: context) } } } @@ -578,7 +578,7 @@ public actor ContainersService { let options = try getContainerCreationOptions(id: id) if options.autoRemove { - try await self.cleanup(id: id, context: context) + try await self.cleanUp(id: id, context: context) } } @@ -586,7 +586,7 @@ public actor ContainersService { "\(Self.launchdDomainString)/\(Self.machServicePrefix).\(runtimeName).\(instanceId)" } - private func _cleanup(id: String) async throws { + private func _cleanUp(id: String) async throws { self.log.debug("\(#function)") // Did the exit container handler win? @@ -611,8 +611,8 @@ public actor ContainersService { self.containers.removeValue(forKey: id) } - private func cleanup(id: String, context: AsyncLock.Context) async throws { - try await self._cleanup(id: id) + private func cleanUp(id: String, context: AsyncLock.Context) async throws { + try await self._cleanUp(id: id) } private func getContainerCreationOptions(id: String) throws -> ContainerCreateOptions { diff --git a/Sources/Services/ContainerImagesService/Server/ImageService.swift b/Sources/Services/ContainerImagesService/Server/ImageService.swift index 108ff5f86..61bb4f6e0 100644 --- a/Sources/Services/ContainerImagesService/Server/ImageService.swift +++ b/Sources/Services/ContainerImagesService/Server/ImageService.swift @@ -128,10 +128,10 @@ public actor ImagesService { return (images, rejectedMembers) } - public func cleanupOrphanedBlobs() async throws -> ([String], UInt64) { + public func cleanUpOrphanedBlobs() async throws -> ([String], UInt64) { let images = try await self._list() let freedSnapshotBytes = try await self.snapshotStore.clean(keepingSnapshotsFor: images) - let (deleted, freedContentBytes) = try await self.imageStore.cleanupOrphanedBlobs() + let (deleted, freedContentBytes) = try await self.imageStore.cleanUpOrphanedBlobs() return (deleted, freedContentBytes + freedSnapshotBytes) } diff --git a/Sources/Services/ContainerImagesService/Server/ImagesServiceHarness.swift b/Sources/Services/ContainerImagesService/Server/ImagesServiceHarness.swift index 8118dee96..e88b2368f 100644 --- a/Sources/Services/ContainerImagesService/Server/ImagesServiceHarness.swift +++ b/Sources/Services/ContainerImagesService/Server/ImagesServiceHarness.swift @@ -182,8 +182,8 @@ public struct ImagesServiceHarness: Sendable { } @Sendable - public func cleanupOrphanedBlobs(_ message: XPCMessage) async throws -> XPCMessage { - let (deleted, size) = try await service.cleanupOrphanedBlobs() + public func cleanUpOrphanedBlobs(_ message: XPCMessage) async throws -> XPCMessage { + let (deleted, size) = try await service.cleanUpOrphanedBlobs() let reply = message.reply() let data = try JSONEncoder().encode(deleted) reply.set(key: .digests, value: data) diff --git a/Sources/Services/ContainerSandboxService/Server/SandboxService.swift b/Sources/Services/ContainerSandboxService/Server/SandboxService.swift index 8b110d4e6..646e4a094 100644 --- a/Sources/Services/ContainerSandboxService/Server/SandboxService.swift +++ b/Sources/Services/ContainerSandboxService/Server/SandboxService.swift @@ -223,10 +223,10 @@ public actor SandboxService { await self.setState(.booted) } catch { do { - try await self.cleanupContainer(containerInfo: ctrInfo) + try await self.cleanUpContainer(containerInfo: ctrInfo) await self.setState(.created) } catch { - self.log.error("failed to cleanup container: \(error)") + self.log.error("Failed to clean up container: \(error)") } throw error } @@ -443,9 +443,9 @@ public actor SandboxService { if case .stopped(_) = await self.state { return message.reply() } - try await self.cleanupContainer(containerInfo: ctr, exitStatus: exitStatus) + try await self.cleanUpContainer(containerInfo: ctr, exitStatus: exitStatus) } catch { - self.log.error("failed to cleanup container: \(error)") + self.log.error("Failed to clean up container: \(error)") } await self.setState(.stopped(exitStatus.exitCode)) default: @@ -668,7 +668,7 @@ public actor SandboxService { } try await self.monitor.track(id: id, waitingOn: waitFunc) } catch { - try? await self.cleanupContainer(containerInfo: info) + try? await self.cleanUpContainer(containerInfo: info) self.setState(.created) throw error } @@ -796,9 +796,9 @@ public actor SandboxService { } do { - try await cleanupContainer(containerInfo: ctrInfo, exitStatus: exitStatus) + try await cleanUpContainer(containerInfo: ctrInfo, exitStatus: exitStatus) } catch { - self.log.error("failed to cleanup container: \(error)") + self.log.error("Failed to clean up container: \(error)") } await setState(.stopped(exitStatus.exitCode)) } @@ -1025,7 +1025,7 @@ public actor SandboxService { return code } - private func cleanupContainer(containerInfo: ContainerInfo, exitStatus: ExitStatus? = nil) async throws { + private func cleanUpContainer(containerInfo: ContainerInfo, exitStatus: ExitStatus? = nil) async throws { let container = containerInfo.container let id = container.id diff --git a/Tests/CLITests/Subcommands/Volumes/TestCLIAnonymousVolumes.swift b/Tests/CLITests/Subcommands/Volumes/TestCLIAnonymousVolumes.swift index b16b97396..b3a2af2e8 100644 --- a/Tests/CLITests/Subcommands/Volumes/TestCLIAnonymousVolumes.swift +++ b/Tests/CLITests/Subcommands/Volumes/TestCLIAnonymousVolumes.swift @@ -24,10 +24,10 @@ class TestCLIAnonymousVolumes: CLITest { override init() throws { try super.init() // Clean up any leftover resources from previous test runs - cleanupAllTestResources() + cleanUpAllTestResources() } - private func cleanupAllTestResources() { + private func cleanUpAllTestResources() { // Clean up test containers (force remove) if let (_, output, _, status) = try? run(arguments: ["ls", "-a"]), status == 0 { let containers = output.components(separatedBy: .newlines) @@ -185,7 +185,7 @@ class TestCLIAnonymousVolumes: CLITest { output = output.trimmingCharacters(in: .whitespacesAndNewlines) #expect(output == testData, "data should persist in anonymous volume") - // Cleanup + // Clean up try doStop(name: containerName2) doRemoveIfExists(name: containerName2, force: true) doVolumeDeleteIfExists(name: volumeID) diff --git a/Tests/CLITests/Subcommands/Volumes/TestCLIVolumes.swift b/Tests/CLITests/Subcommands/Volumes/TestCLIVolumes.swift index c46a594d0..3807f40a3 100644 --- a/Tests/CLITests/Subcommands/Volumes/TestCLIVolumes.swift +++ b/Tests/CLITests/Subcommands/Volumes/TestCLIVolumes.swift @@ -71,7 +71,7 @@ class TestCLIVolumes: CLITest { doRemoveIfExists(name: container2Name, force: true) defer { - // Cleanup containers and volume + // Clean up containers and volume try? doStop(name: container1Name) doRemoveIfExists(name: container1Name, force: true) try? doStop(name: container2Name) @@ -118,7 +118,7 @@ class TestCLIVolumes: CLITest { doRemoveIfExists(name: container2Name, force: true) defer { - // Cleanup containers and volume + // Clean up containers and volume try? doStop(name: container1Name) doRemoveIfExists(name: container1Name, force: true) try? doStop(name: container2Name) @@ -138,7 +138,7 @@ class TestCLIVolumes: CLITest { #expect(status != 0, "second container should fail when trying to use volume already in use") - // Cleanup + // Clean up try doStop(name: container1Name) doRemoveIfExists(name: container1Name, force: true) doVolumeDeleteIfExists(name: volumeName) @@ -154,7 +154,7 @@ class TestCLIVolumes: CLITest { doRemoveIfExists(name: containerName, force: true) defer { - // Cleanup container and volume + // Clean up container and volume try? doStop(name: containerName) doRemoveIfExists(name: containerName, force: true) doVolumeDeleteIfExists(name: volumeName) @@ -189,7 +189,7 @@ class TestCLIVolumes: CLITest { doRemoveIfExists(name: containerName, force: true) defer { - // Cleanup container and volume + // Clean up container and volume try? doStop(name: containerName) doRemoveIfExists(name: containerName, force: true) doVolumeDeleteIfExists(name: volumeName)