Skip to content

Commit 6feebf7

Browse files
authored
Merge branch 'main' into add-builder-tests
2 parents d7fcae6 + 21dabb7 commit 6feebf7

21 files changed

Lines changed: 79 additions & 54 deletions

File tree

.github/workflows/pr-label-apply.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,12 @@ jobs:
2929
run-id: ${{ github.event.workflow_run.id }}
3030
pattern: pr-metadata-*
3131
merge-multiple: false
32-
continue-on-error: true
3332
id: download-artifact
3433

3534
- name: Read PR number
3635
id: pr-number
3736
run: |
38-
METADATA_DIR=$(find . -type d -name "pr-metadata-*" 2>/dev/null | head -n 1)
39-
40-
if [ -z "$METADATA_DIR" ]; then
41-
echo "No metadata found"
42-
exit 1
43-
fi
44-
45-
PR_NUMBER=$(cat "${METADATA_DIR}/pr-number.txt")
37+
PR_NUMBER=$(cat "pr-number.txt")
4638
echo "number=${PR_NUMBER}" >> $GITHUB_OUTPUT
4739
echo "PR Number: ${PR_NUMBER}"
4840

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.8.0"
26-
let scVersion = "0.24.5"
26+
let scVersion = "0.25.0"
2727

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

Sources/ContainerBuild/BuildImageResolver.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ struct BuildImageResolver: BuildPipelineHandler {
2626
let contentStore: ContentStore
2727
let quiet: Bool
2828
let output: FileHandle
29+
let pull: Bool
2930

30-
public init(_ contentStore: ContentStore, quiet: Bool = false, output: FileHandle = FileHandle.standardError) throws {
31+
public init(_ contentStore: ContentStore, quiet: Bool = false, output: FileHandle = FileHandle.standardError, pull: Bool = false) throws {
3132
self.contentStore = contentStore
3233
self.quiet = quiet
3334
self.output = output
35+
self.pull = pull
3436
}
3537

3638
func accept(_ packet: ServerStream) throws -> Bool {
@@ -72,6 +74,9 @@ struct BuildImageResolver: BuildPipelineHandler {
7274
defer { progress.finish() }
7375
progress.start()
7476

77+
if self.pull {
78+
return try await ClientImage.pull(reference: ref, platform: platform, progressUpdate: progress.handler)
79+
}
7580
// Use fetch() which checks cache first, then pulls if needed
7681
return try await ClientImage.fetch(reference: ref, platform: platform, progressUpdate: progress.handler)
7782
}()

Sources/ContainerBuild/BuildPipelineHandler.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public actor BuildPipeline {
3030
[
3131
try BuildFSSync(URL(filePath: config.contextDir)),
3232
try BuildRemoteContentProxy(config.contentStore),
33-
try BuildImageResolver(config.contentStore, quiet: config.quiet, output: config.terminal?.handle ?? FileHandle.standardError),
33+
try BuildImageResolver(config.contentStore, quiet: config.quiet, output: config.terminal?.handle ?? FileHandle.standardError, pull: config.pull),
3434
try BuildStdio(quiet: config.quiet, output: config.terminal?.handle ?? FileHandle.standardError),
3535
]
3636
}

Sources/ContainerBuild/Builder.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ public struct Builder: Sendable {
251251
public let exports: [BuildExport]
252252
public let cacheIn: [String]
253253
public let cacheOut: [String]
254+
public let pull: Bool
254255

255256
public init(
256257
buildID: String,
@@ -268,6 +269,7 @@ public struct Builder: Sendable {
268269
exports: [BuildExport],
269270
cacheIn: [String],
270271
cacheOut: [String],
272+
pull: Bool
271273
) {
272274
self.buildID = buildID
273275
self.contentStore = contentStore
@@ -284,6 +286,7 @@ public struct Builder: Sendable {
284286
self.exports = exports
285287
self.cacheIn = cacheIn
286288
self.cacheOut = cacheOut
289+
self.pull = pull
287290
}
288291
}
289292
}

Sources/ContainerCommands/BuildCommand.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ extension Application {
131131
@Argument(help: "Build directory")
132132
var contextDir: String = "."
133133

134+
@Flag(name: .long, help: "Pull latest image")
135+
var pull: Bool = false
136+
134137
public func run() async throws {
135138
do {
136139
let timeout: Duration = .seconds(300)
@@ -313,7 +316,7 @@ extension Application {
313316
}
314317
return results
315318
}()
316-
group.addTask { [terminal, buildArg, contextDir, label, noCache, target, quiet, cacheIn, cacheOut] in
319+
group.addTask { [terminal, buildArg, contextDir, label, noCache, target, quiet, cacheIn, cacheOut, pull] in
317320
let config = Builder.BuildConfig(
318321
buildID: buildID,
319322
contentStore: RemoteContentStoreClient(),
@@ -329,7 +332,8 @@ extension Application {
329332
quiet: quiet,
330333
exports: exports,
331334
cacheIn: cacheIn,
332-
cacheOut: cacheOut
335+
cacheOut: cacheOut,
336+
pull: pull
333337
)
334338
progress.finish()
335339

Sources/ContainerCommands/Image/ImageDelete.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ extension Application {
6969
failures.append(image.reference)
7070
}
7171
}
72-
let (_, size) = try await ClientImage.cleanupOrphanedBlobs()
72+
let (_, size) = try await ClientImage.cleanUpOrphanedBlobs()
7373
let formatter = ByteCountFormatter()
7474
let freed = formatter.string(fromByteCount: Int64(size))
7575

Sources/ContainerCommands/Image/ImagePrune.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ extension Application {
6565
}
6666
}
6767

68-
let (deletedDigests, size) = try await ClientImage.cleanupOrphanedBlobs()
68+
let (deletedDigests, size) = try await ClientImage.cleanUpOrphanedBlobs()
6969

7070
for image in imagesToPrune {
7171
print("untagged \(image.reference)")

Sources/ContainerCommands/Registry/Login.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ extension Application {
5656
}
5757
password = String(decoding: passwordData, as: UTF8.self).trimmingCharacters(in: .whitespacesAndNewlines)
5858
}
59-
let keychain = KeychainHelper(id: Constants.keychainID)
59+
let keychain = KeychainHelper(securityDomain: Constants.keychainID)
6060
if username == "" {
61-
username = try keychain.userPrompt(domain: server)
61+
username = try keychain.userPrompt(hostname: server)
6262
}
6363
if password == "" {
6464
password = try keychain.passwordPrompt()
@@ -89,7 +89,7 @@ extension Application {
8989
)
9090
)
9191
try await client.ping()
92-
try keychain.save(domain: server, username: username, password: password)
92+
try keychain.save(hostname: server, username: username, password: password)
9393
print("Login succeeded")
9494
}
9595
}

0 commit comments

Comments
 (0)