CLI: Fix image import to output the image ID, allow untagged images, and support --no-trunc#40856
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aligns wslc image import behavior with Docker by returning/printing the imported image’s ID, allowing imports without a tag (creating an untagged image), and adding --no-trunc support for full-length ID output.
Changes:
- Extended the service
ImportImageCOM API to accept a nullable image name and return the imported image ID. - Updated the CLI import task to print the (optionally truncated) image ID on success and added
--no-trunctoimage import. - Updated Windows unit/e2e tests for import output,
--no-trunc, and untagged import behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/WSLCTests.cpp | Updates COM test calls to pass the new ImageId out-parameter. |
| test/windows/wslc/e2e/WSLCE2EImageImportTests.cpp | Adds e2e assertions for import ID output (trunc/no-trunc) and untagged import behavior. |
| src/windows/wslcsession/WSLCSession.h | Updates WSLCSession ImportImage signatures and changes ImportImageImpl to return an ID string. |
| src/windows/wslcsession/WSLCSession.cpp | Implements optional image name handling, captures/returns image ID from Docker progress, and plumbs it back via [out] LPSTR*. |
| src/windows/WslcSDK/wslcsdk.cpp | Updates SDK wrapper to satisfy the new COM ImportImage signature by providing an out parameter. |
| src/windows/wslc/tasks/ImageTasks.cpp | Prints the imported image ID and honors --no-trunc. |
| src/windows/wslc/services/ImageService.h | Changes ImageService::Import to return the imported image ID. |
| src/windows/wslc/services/ImageService.cpp | Plumbs through the ImportImage out-parameter and returns the ID to callers. |
| src/windows/wslc/commands/ImageImportCommand.cpp | Adds ArgType::NoTrunc to the image import command arguments. |
| src/windows/service/inc/WSLCCompat.idl | Extends compat ImportImage signature to return ImageId. |
| src/windows/service/inc/wslc.idl | Extends IWSLCSession::ImportImage signature to return ImageId. |
OneBlue
reviewed
Jun 19, 2026
OneBlue
previously approved these changes
Jun 22, 2026
OneBlue
approved these changes
Jun 22, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary of the Pull Request
This PR fixes three related bugs with wslc image import, all of which align it with the equivalent Docker command.
Docker CLI outputs the imported image's ID to stdout. We now do the same — the server captures the ID from Docker's API response (via the status field) and returns it through a new [out] LPSTR* ImageId parameter on ImportImage. The CLI displays it truncated to 12 hex chars (matching Docker's default), with sha256: prefix stripped.
Docker allows docker import file.tar without specifying a repository:tag, creating a : image. We now support the same — ImageName is [in, unique] (nullable) in the IDL, and the server passes empty repo/tag to the Docker API when no name is provided.
Added ArgType::NoTrunc to the import command's arguments. When passed, the full image ID is output instead of the 12-char truncated form.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed