Use a lock consistently in the ExecutionContext class (#619)

The changes in this PR improve the consistency of using a lock in the
`ExecutionContext` class.
This commit is contained in:
Dmitry Kovba
2025-09-17 09:49:30 -07:00
committed by GitHub
parent 449f1d23df
commit c571546f60
@@ -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