Move to TOML configuration for defaults (#1425)

- Discussion topic #1336.
- This change migrates away from using `UserDefaults`,
  instead providing a TOML configuration mechanism for
  user configurable settings. All existing system property
  settings keys are supported in the new configuration
  file. However, users will have to migrate any settings
  they have configured in the `UserDefaults` into TOML
  for these settings to take effect.
- Breaking changes:
  * `container system property get` is removed in favor of
    users directly utilizing `container system property list --format toml | jq<>`.
  * `container system property set` is removed since the TOML
    configuration is effectively immutable during the lifetime of the
    `container` daemon. Uses can edit the TOML they have in their home
    directory, however no changes will take effect until the daemon is
    restarted via `container system stop && container system start`
* `container system property list --format table` is removed as
    generating tabular format is non-trivial and the new TOML format is
    intended to be human readable
This commit is contained in:
Noah Thornton
2026-05-04 12:04:24 -07:00
committed by GitHub
parent 8a25213190
commit e3c49803a0
56 changed files with 1168 additions and 971 deletions
@@ -15,6 +15,7 @@
//===----------------------------------------------------------------------===//
import ContainerAPIClient
import ContainerPersistence
import Containerization
import ContainerizationOCI
import Foundation
@@ -27,12 +28,16 @@ struct BuildImageResolver: BuildPipelineHandler {
let quiet: Bool
let output: FileHandle
let pull: Bool
let containerSystemConfig: ContainerSystemConfig
public init(_ contentStore: ContentStore, quiet: Bool = false, output: FileHandle = FileHandle.standardError, pull: Bool = false) throws {
public init(_ contentStore: ContentStore, quiet: Bool = false, output: FileHandle = FileHandle.standardError, pull: Bool = false, containerSystemConfig: ContainerSystemConfig)
throws
{
self.contentStore = contentStore
self.quiet = quiet
self.output = output
self.pull = pull
self.containerSystemConfig = containerSystemConfig
}
func accept(_ packet: ServerStream) throws -> Bool {
@@ -75,10 +80,10 @@ struct BuildImageResolver: BuildPipelineHandler {
progress.start()
if self.pull {
return try await ClientImage.pull(reference: ref, platform: platform, progressUpdate: progress.handler)
return try await ClientImage.pull(reference: ref, platform: platform, containerSystemConfig: containerSystemConfig, progressUpdate: progress.handler)
}
// Use fetch() which checks cache first, then pulls if needed
return try await ClientImage.fetch(reference: ref, platform: platform, progressUpdate: progress.handler)
return try await ClientImage.fetch(reference: ref, platform: platform, containerSystemConfig: containerSystemConfig, progressUpdate: progress.handler)
}()
let index: Index = try await img.index()
@@ -30,7 +30,13 @@ public actor BuildPipeline {
[
try BuildFSSync(URL(filePath: config.contextDir)),
try BuildRemoteContentProxy(config.contentStore),
try BuildImageResolver(config.contentStore, quiet: config.quiet, output: config.terminal?.handle ?? FileHandle.standardError, pull: config.pull),
try BuildImageResolver(
config.contentStore,
quiet: config.quiet,
output: config.terminal?.handle ?? FileHandle.standardError,
pull: config.pull,
containerSystemConfig: config.containerSystemConfig
),
try BuildStdio(quiet: config.quiet, output: config.terminal?.handle ?? FileHandle.standardError),
]
}
+5 -1
View File
@@ -15,6 +15,7 @@
//===----------------------------------------------------------------------===//
import ContainerAPIClient
import ContainerPersistence
import Containerization
import ContainerizationOCI
import ContainerizationOS
@@ -279,6 +280,7 @@ public struct Builder: Sendable {
public let cacheIn: [String]
public let cacheOut: [String]
public let pull: Bool
public let containerSystemConfig: ContainerSystemConfig
public init(
buildID: String,
@@ -298,7 +300,8 @@ public struct Builder: Sendable {
exports: [BuildExport],
cacheIn: [String],
cacheOut: [String],
pull: Bool
pull: Bool,
containerSystemConfig: ContainerSystemConfig
) {
self.buildID = buildID
self.contentStore = contentStore
@@ -318,6 +321,7 @@ public struct Builder: Sendable {
self.cacheIn = cacheIn
self.cacheOut = cacheOut
self.pull = pull
self.containerSystemConfig = containerSystemConfig
}
}