-
-
Notifications
You must be signed in to change notification settings - Fork 816
feat(lume): OCI-compliant image format with multi-layer and single-layer support #1144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ddupont808
wants to merge
14
commits into
main
Choose a base branch
from
ddupont/oci-lume
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
47d08ee
make skill more token efficient
ddupont808 bd27c2f
OCI-compliance
ddupont808 4880e69
support multi-layer OCI
ddupont808 2c46d51
feat(lume): add single-layer OCI push and sparse-aware pull support
ddupont808 cfe756e
Merge branch 'main' into ddupont/oci-lume
ddupont808 e756318
fix(lume): gzip decompression, GCS flag validation, Convert cleanup, …
ddupont808 2c31a32
fix(lume): validate --single-layer and --legacy are mutually exclusive
ddupont808 5a13c0b
feat(lume): compact progress display, log level filtering, parallel u…
ddupont808 b38a02b
fix(lume): increase upload timeout to 1h, add --single-layer to convert
ddupont808 d2964ad
feat(lume): real upload progress tracking via URLSession delegate
ddupont808 dde5d89
feat(lume): in-process zlib gzip compression with progress tracking
ddupont808 4b021cc
feat(lume): downgrade chatty logs to debug, wire --verbose flag to Lo…
ddupont808 1ddbf74
parallel compress+upload pipelines, dedup layers, ETA improvements
ddupont808 36aaef1
Docker-style progress, accurate ETA, terminal overflow fix
ddupont808 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| module CZlib [system] { | ||
| header "shim.h" | ||
| link "z" | ||
| export * | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| #include <zlib.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| import ArgumentParser | ||
| import Foundation | ||
|
|
||
| struct Convert: AsyncParsableCommand { | ||
| static let configuration = CommandConfiguration( | ||
| abstract: "Convert a legacy Lume image to OCI-compliant format", | ||
| discussion: """ | ||
| Pulls a legacy Lume image from the registry, re-pushes it in OCI-compliant format | ||
| under a new name/tag, then removes the temporary local VM. | ||
|
|
||
| Example: | ||
| lume convert macos-sequoia:latest trycua/macos-sequoia:latest-oci | ||
| """ | ||
| ) | ||
|
|
||
| @Argument(help: "Source image to convert (legacy format, e.g. macos-sequoia:latest)") | ||
| var sourceImage: String | ||
|
|
||
| @Argument(help: "Target image to push in OCI format (format: name:tag)") | ||
| var targetImage: String | ||
|
|
||
| @Option(parsing: .upToNextOption, help: "Additional tags to push the OCI image to") | ||
| var additionalTags: [String] = [] | ||
|
|
||
| @Option(help: "Registry to pull from and push to. Defaults to ghcr.io") | ||
| var registry: String = "ghcr.io" | ||
|
|
||
| @Option(help: "Organization. Defaults to trycua") | ||
| var organization: String = "trycua" | ||
|
|
||
| @Flag(name: .long, help: "Enable verbose logging") | ||
| var verbose: Bool = false | ||
|
|
||
| @Flag(name: .long, help: "Prepare files without uploading to registry") | ||
| var dryRun: Bool = false | ||
|
|
||
| @Flag(name: .long, help: "Push as a single disk layer (kubelet-compatible, no chunking)") | ||
| var singleLayer: Bool = false | ||
|
|
||
| init() {} | ||
|
|
||
| @MainActor | ||
| func run() async throws { | ||
| if verbose { Logger.setVerbose() } | ||
|
|
||
| TelemetryClient.shared.record(event: TelemetryEvent.push) | ||
|
|
||
| let targetComponents = targetImage.split(separator: ":") | ||
| guard targetComponents.count == 2, let primaryTag = targetComponents.last else { | ||
| throw ValidationError("Invalid target image format. Expected format: name:tag") | ||
| } | ||
| let targetName = String(targetComponents.first!) | ||
|
|
||
| var allTags: Swift.Set<String> = [String(primaryTag)] | ||
| allTags.formUnion(additionalTags) | ||
|
|
||
| // Use a unique temp VM name to avoid collisions | ||
| let tempVMName = "__lume_convert_\(UUID().uuidString.prefix(8))" | ||
|
|
||
| let controller = LumeController() | ||
|
|
||
| Logger.debug( | ||
| "Converting legacy image to OCI-compliant format", | ||
| metadata: [ | ||
| "source": sourceImage, | ||
| "target": targetImage, | ||
| "registry": registry, | ||
| "organization": organization, | ||
| ]) | ||
|
|
||
| // Step 1: Pull the legacy source image into a temp VM | ||
| Logger.info("Step 1/3: Pulling source image '\(sourceImage)'…") | ||
| do { | ||
| try await controller.pullImage( | ||
| image: sourceImage, | ||
| name: tempVMName, | ||
| registry: registry, | ||
| organization: organization | ||
| ) | ||
| } catch { | ||
| Logger.error("Pull failed, cleaning up temp VM: \(error.localizedDescription)") | ||
| try? await controller.delete(name: tempVMName) | ||
| throw error | ||
| } | ||
|
|
||
| // Step 2: Push the temp VM in OCI-compliant format | ||
| Logger.info("Step 2/3: Pushing '\(sourceImage)' as OCI-compliant '\(targetImage)'…") | ||
| do { | ||
| try await controller.pushImage( | ||
| name: tempVMName, | ||
| imageName: targetName, | ||
| tags: Array(allTags), | ||
| registry: registry, | ||
| organization: organization, | ||
| verbose: verbose, | ||
| dryRun: dryRun, | ||
| reassemble: false, | ||
| singleLayer: singleLayer, | ||
| legacy: false // OCI-compliant output | ||
| ) | ||
| } catch { | ||
| // Always clean up the temp VM even if push fails | ||
| Logger.error("Push failed, cleaning up temp VM: \(error.localizedDescription)") | ||
| try? await controller.delete(name: tempVMName) | ||
| throw error | ||
| } | ||
|
|
||
| // Step 3: Remove the temp VM | ||
| Logger.info("Step 3/3: Cleaning up temporary VM…") | ||
| try await controller.delete(name: tempVMName) | ||
|
|
||
| Logger.info( | ||
| "Conversion complete", | ||
| metadata: [ | ||
| "source": sourceImage, | ||
| "target": targetImage, | ||
| ]) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.