Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions Sources/NativeBuilder/ContainerBuildExecutor/ExecutionContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,19 @@ public final class ExecutionContext: @unchecked Sendable {

/// Create a child context for a nested execution.
public func childContext(for stage: BuildStage) -> ExecutionContext {
lock.withLock {
ExecutionContext(
stage: stage,
graph: graph,
platform: platform,
reporter: reporter,
snapshotter: snapshotter,
baseEnvironment: Environment(_environment.variables),
baseConfig: _imageConfig
)
let (environmentVars, imageConfig) = lock.withLock {
(_environment.variables, _imageConfig)
}

return ExecutionContext(
stage: stage,
graph: graph,
platform: platform,
reporter: reporter,
snapshotter: snapshotter,
baseEnvironment: Environment(environmentVars),
baseConfig: imageConfig
)
}

// MARK: - Snapshotter Integration
Expand All @@ -201,7 +203,7 @@ public final class ExecutionContext: @unchecked Sendable {
/// - Returns: A prepared snapshot ready for modification
/// - Throws: Any errors from the snapshotter
public func prepareSnapshot(for operationId: UUID) async throws -> Snapshot {
let parentCommitted = headSnapshot
let parentCommitted = lock.withLock { _headSnapshot }
Copy link
Contributor

@wlan0 wlan0 Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

headSnapshot is already protected by a lock, is this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mixed use of headSnapshot and _headSnapshot might be confusing. But this is not incorrect.


// Always create a new child snapshot that points to the latest committed snapshot (if any).
// Prepare is responsible for ensuring both the child mountpoint and parent materialization (if needed).
Expand Down