Skip to content

Commit 6cb40b3

Browse files
Add image env variables to builder start command (#756)
## Type of Change - [x] Bug fix ## Motivation and Context Required for builder to run correctly with bug fix in containerization here apple/containerization#329. Builder was previously not passing any environment variables when starting the initial process. ## Testing - [x] Tested locally --------- Signed-off-by: Kathryn Baldauf <[email protected]>
1 parent d8eb510 commit 6cb40b3

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import PackageDescription
2323
let releaseVersion = ProcessInfo.processInfo.environment["RELEASE_VERSION"] ?? "0.0.0"
2424
let gitCommit = ProcessInfo.processInfo.environment["GIT_COMMIT"] ?? "unspecified"
2525
let builderShimVersion = "0.6.1"
26-
let scVersion = "0.10.0"
26+
let scVersion = "0.10.1"
2727

2828
let package = Package(
2929
name: "container",

Sources/ContainerCommands/Builder/BuilderStart.swift

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -148,20 +148,6 @@ extension Application {
148148
let id = "buildkit"
149149
try ContainerClient.Utility.validEntityName(id)
150150

151-
let processConfig = ProcessConfiguration(
152-
executable: "/usr/local/bin/container-builder-shim",
153-
arguments: shimArguments,
154-
environment: [],
155-
workingDirectory: "/",
156-
terminal: false,
157-
user: .id(uid: 0, gid: 0)
158-
)
159-
160-
let resources = try Parser.resources(
161-
cpus: cpus,
162-
memory: memory
163-
)
164-
165151
let image = try await ClientImage.fetch(
166152
reference: builderImage,
167153
platform: builderPlatform,
@@ -178,12 +164,28 @@ extension Application {
178164
platform: builderPlatform,
179165
progressUpdate: ProgressTaskCoordinator.handler(for: unpackTask, from: progressUpdate)
180166
)
181-
let imageConfig = ImageDescription(
167+
168+
let imageDesc = ImageDescription(
182169
reference: builderImage,
183170
descriptor: image.descriptor
184171
)
185172

186-
var config = ContainerConfiguration(id: id, image: imageConfig, process: processConfig)
173+
let imageConfig = try await image.config(for: builderPlatform).config
174+
let processConfig = ProcessConfiguration(
175+
executable: "/usr/local/bin/container-builder-shim",
176+
arguments: shimArguments,
177+
environment: imageConfig?.env ?? [],
178+
workingDirectory: "/",
179+
terminal: false,
180+
user: .id(uid: 0, gid: 0)
181+
)
182+
183+
let resources = try Parser.resources(
184+
cpus: cpus,
185+
memory: memory
186+
)
187+
188+
var config = ContainerConfiguration(id: id, image: imageDesc, process: processConfig)
187189
config.resources = resources
188190
config.mounts = [
189191
.init(

0 commit comments

Comments
 (0)